/*
 *
 * Copyright 2021-2024 Software Radio Systems Limited
 *
 * This file is part of srsRAN.
 *
 * srsRAN is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of
 * the License, or (at your option) any later version.
 *
 * srsRAN is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * A copy of the GNU Affero General Public License can be found in
 * the LICENSE file in the top-level directory of this distribution
 * and at http://www.gnu.org/licenses/.
 *
 */

#include "srsran/asn1/rrc_nr/bwp_cfg.h"
using namespace asn1;
using namespace asn1::rrc_nr;

/*******************************************************************************
 *                                Struct Methods
 ******************************************************************************/

// MsgA-DMRS-Config-r16 ::= SEQUENCE
SRSASN_CODE msg_a_dmrs_cfg_r16_s::pack(bit_ref& bref) const
{
  HANDLE_CODE(bref.pack(msg_a_dmrs_add_position_r16_present, 1));
  HANDLE_CODE(bref.pack(msg_a_max_len_r16_present, 1));
  HANDLE_CODE(bref.pack(msg_a_pusch_dmrs_cdm_group_r16_present, 1));
  HANDLE_CODE(bref.pack(msg_a_pusch_nrof_ports_r16_present, 1));
  HANDLE_CODE(bref.pack(msg_a_scrambling_id0_r16_present, 1));
  HANDLE_CODE(bref.pack(msg_a_scrambling_id1_r16_present, 1));

  if (msg_a_dmrs_add_position_r16_present) {
    HANDLE_CODE(msg_a_dmrs_add_position_r16.pack(bref));
  }
  if (msg_a_pusch_dmrs_cdm_group_r16_present) {
    HANDLE_CODE(pack_integer(bref, msg_a_pusch_dmrs_cdm_group_r16, (uint8_t)0u, (uint8_t)1u));
  }
  if (msg_a_pusch_nrof_ports_r16_present) {
    HANDLE_CODE(pack_integer(bref, msg_a_pusch_nrof_ports_r16, (uint8_t)0u, (uint8_t)1u));
  }
  if (msg_a_scrambling_id0_r16_present) {
    HANDLE_CODE(pack_integer(bref, msg_a_scrambling_id0_r16, (uint32_t)0u, (uint32_t)65535u));
  }
  if (msg_a_scrambling_id1_r16_present) {
    HANDLE_CODE(pack_integer(bref, msg_a_scrambling_id1_r16, (uint32_t)0u, (uint32_t)65535u));
  }

  return SRSASN_SUCCESS;
}
SRSASN_CODE msg_a_dmrs_cfg_r16_s::unpack(cbit_ref& bref)
{
  HANDLE_CODE(bref.unpack(msg_a_dmrs_add_position_r16_present, 1));
  HANDLE_CODE(bref.unpack(msg_a_max_len_r16_present, 1));
  HANDLE_CODE(bref.unpack(msg_a_pusch_dmrs_cdm_group_r16_present, 1));
  HANDLE_CODE(bref.unpack(msg_a_pusch_nrof_ports_r16_present, 1));
  HANDLE_CODE(bref.unpack(msg_a_scrambling_id0_r16_present, 1));
  HANDLE_CODE(bref.unpack(msg_a_scrambling_id1_r16_present, 1));

  if (msg_a_dmrs_add_position_r16_present) {
    HANDLE_CODE(msg_a_dmrs_add_position_r16.unpack(bref));
  }
  if (msg_a_pusch_dmrs_cdm_group_r16_present) {
    HANDLE_CODE(unpack_integer(msg_a_pusch_dmrs_cdm_group_r16, bref, (uint8_t)0u, (uint8_t)1u));
  }
  if (msg_a_pusch_nrof_ports_r16_present) {
    HANDLE_CODE(unpack_integer(msg_a_pusch_nrof_ports_r16, bref, (uint8_t)0u, (uint8_t)1u));
  }
  if (msg_a_scrambling_id0_r16_present) {
    HANDLE_CODE(unpack_integer(msg_a_scrambling_id0_r16, bref, (uint32_t)0u, (uint32_t)65535u));
  }
  if (msg_a_scrambling_id1_r16_present) {
    HANDLE_CODE(unpack_integer(msg_a_scrambling_id1_r16, bref, (uint32_t)0u, (uint32_t)65535u));
  }

  return SRSASN_SUCCESS;
}
void msg_a_dmrs_cfg_r16_s::to_json(json_writer& j) const
{
  j.start_obj();
  if (msg_a_dmrs_add_position_r16_present) {
    j.write_str("msgA-DMRS-AdditionalPosition-r16", msg_a_dmrs_add_position_r16.to_string());
  }
  if (msg_a_max_len_r16_present) {
    j.write_str("msgA-MaxLength-r16", "len2");
  }
  if (msg_a_pusch_dmrs_cdm_group_r16_present) {
    j.write_int("msgA-PUSCH-DMRS-CDM-Group-r16", msg_a_pusch_dmrs_cdm_group_r16);
  }
  if (msg_a_pusch_nrof_ports_r16_present) {
    j.write_int("msgA-PUSCH-NrofPorts-r16", msg_a_pusch_nrof_ports_r16);
  }
  if (msg_a_scrambling_id0_r16_present) {
    j.write_int("msgA-ScramblingID0-r16", msg_a_scrambling_id0_r16);
  }
  if (msg_a_scrambling_id1_r16_present) {
    j.write_int("msgA-ScramblingID1-r16", msg_a_scrambling_id1_r16);
  }
  j.end_obj();
}

const char* msg_a_dmrs_cfg_r16_s::msg_a_dmrs_add_position_r16_opts::to_string() const
{
  static const char* names[] = {"pos0", "pos1", "pos3"};
  return convert_enum_idx(names, 3, value, "msg_a_dmrs_cfg_r16_s::msg_a_dmrs_add_position_r16_e_");
}
uint8_t msg_a_dmrs_cfg_r16_s::msg_a_dmrs_add_position_r16_opts::to_number() const
{
  static const uint8_t numbers[] = {0, 1, 3};
  return map_enum_number(numbers, 3, value, "msg_a_dmrs_cfg_r16_s::msg_a_dmrs_add_position_r16_e_");
}

// RA-Prioritization ::= SEQUENCE
SRSASN_CODE ra_prioritization_s::pack(bit_ref& bref) const
{
  bref.pack(ext, 1);
  HANDLE_CODE(bref.pack(scaling_factor_bi_present, 1));

  HANDLE_CODE(pwr_ramp_step_high_prio.pack(bref));
  if (scaling_factor_bi_present) {
    HANDLE_CODE(scaling_factor_bi.pack(bref));
  }

  return SRSASN_SUCCESS;
}
SRSASN_CODE ra_prioritization_s::unpack(cbit_ref& bref)
{
  bref.unpack(ext, 1);
  HANDLE_CODE(bref.unpack(scaling_factor_bi_present, 1));

  HANDLE_CODE(pwr_ramp_step_high_prio.unpack(bref));
  if (scaling_factor_bi_present) {
    HANDLE_CODE(scaling_factor_bi.unpack(bref));
  }

  return SRSASN_SUCCESS;
}
void ra_prioritization_s::to_json(json_writer& j) const
{
  j.start_obj();
  j.write_str("powerRampingStepHighPriority", pwr_ramp_step_high_prio.to_string());
  if (scaling_factor_bi_present) {
    j.write_str("scalingFactorBI", scaling_factor_bi.to_string());
  }
  j.end_obj();
}

const char* ra_prioritization_s::pwr_ramp_step_high_prio_opts::to_string() const
{
  static const char* names[] = {"dB0", "dB2", "dB4", "dB6"};
  return convert_enum_idx(names, 4, value, "ra_prioritization_s::pwr_ramp_step_high_prio_e_");
}
uint8_t ra_prioritization_s::pwr_ramp_step_high_prio_opts::to_number() const
{
  static const uint8_t numbers[] = {0, 2, 4, 6};
  return map_enum_number(numbers, 4, value, "ra_prioritization_s::pwr_ramp_step_high_prio_e_");
}

const char* ra_prioritization_s::scaling_factor_bi_opts::to_string() const
{
  static const char* names[] = {"zero", "dot25", "dot5", "dot75"};
  return convert_enum_idx(names, 4, value, "ra_prioritization_s::scaling_factor_bi_e_");
}
uint8_t ra_prioritization_s::scaling_factor_bi_opts::to_number() const
{
  static const uint8_t numbers[] = {0, 25, 5, 75};
  return map_enum_number(numbers, 4, value, "ra_prioritization_s::scaling_factor_bi_e_");
}

// MsgA-PUSCH-Resource-r16 ::= SEQUENCE
SRSASN_CODE msg_a_pusch_res_r16_s::pack(bit_ref& bref) const
{
  bref.pack(ext, 1);
  HANDLE_CODE(bref.pack(msg_a_pusch_time_domain_alloc_r16_present, 1));
  HANDLE_CODE(bref.pack(start_symbol_and_len_msg_a_po_r16_present, 1));
  HANDLE_CODE(bref.pack(map_type_msg_a_pusch_r16_present, 1));
  HANDLE_CODE(bref.pack(guard_period_msg_a_pusch_r16_present, 1));
  HANDLE_CODE(bref.pack(msg_a_intra_slot_freq_hop_r16_present, 1));
  HANDLE_CODE(bref.pack(msg_a_hop_bits_r16_present, 1));
  HANDLE_CODE(bref.pack(msg_a_alpha_r16_present, 1));
  HANDLE_CODE(bref.pack(interlace_idx_first_po_msg_a_pusch_r16_present, 1));
  HANDLE_CODE(bref.pack(nrof_interlaces_per_msg_a_po_r16_present, 1));

  HANDLE_CODE(pack_integer(bref, msg_a_mcs_r16, (uint8_t)0u, (uint8_t)15u));
  HANDLE_CODE(pack_integer(bref, nrof_slots_msg_a_pusch_r16, (uint8_t)1u, (uint8_t)4u));
  HANDLE_CODE(nrof_msg_a_po_per_slot_r16.pack(bref));
  HANDLE_CODE(pack_integer(bref, msg_a_pusch_time_domain_offset_r16, (uint8_t)1u, (uint8_t)32u));
  if (msg_a_pusch_time_domain_alloc_r16_present) {
    HANDLE_CODE(pack_integer(bref, msg_a_pusch_time_domain_alloc_r16, (uint8_t)1u, (uint8_t)16u));
  }
  if (start_symbol_and_len_msg_a_po_r16_present) {
    HANDLE_CODE(pack_integer(bref, start_symbol_and_len_msg_a_po_r16, (uint8_t)0u, (uint8_t)127u));
  }
  if (map_type_msg_a_pusch_r16_present) {
    HANDLE_CODE(map_type_msg_a_pusch_r16.pack(bref));
  }
  if (guard_period_msg_a_pusch_r16_present) {
    HANDLE_CODE(pack_integer(bref, guard_period_msg_a_pusch_r16, (uint8_t)0u, (uint8_t)3u));
  }
  HANDLE_CODE(pack_integer(bref, guard_band_msg_a_pusch_r16, (uint8_t)0u, (uint8_t)1u));
  HANDLE_CODE(pack_integer(bref, freq_start_msg_a_pusch_r16, (uint16_t)0u, (uint16_t)274u));
  HANDLE_CODE(pack_integer(bref, nrof_prbs_per_msg_a_po_r16, (uint8_t)1u, (uint8_t)32u));
  HANDLE_CODE(nrof_msg_a_po_fdm_r16.pack(bref));
  if (msg_a_hop_bits_r16_present) {
    HANDLE_CODE(msg_a_hop_bits_r16.pack(bref));
  }
  HANDLE_CODE(msg_a_dmrs_cfg_r16.pack(bref));
  HANDLE_CODE(pack_integer(bref, nrof_dmrs_seqs_r16, (uint8_t)1u, (uint8_t)2u));
  if (msg_a_alpha_r16_present) {
    HANDLE_CODE(msg_a_alpha_r16.pack(bref));
  }
  if (interlace_idx_first_po_msg_a_pusch_r16_present) {
    HANDLE_CODE(pack_integer(bref, interlace_idx_first_po_msg_a_pusch_r16, (uint8_t)1u, (uint8_t)10u));
  }
  if (nrof_interlaces_per_msg_a_po_r16_present) {
    HANDLE_CODE(pack_integer(bref, nrof_interlaces_per_msg_a_po_r16, (uint8_t)1u, (uint8_t)10u));
  }

  return SRSASN_SUCCESS;
}
SRSASN_CODE msg_a_pusch_res_r16_s::unpack(cbit_ref& bref)
{
  bref.unpack(ext, 1);
  HANDLE_CODE(bref.unpack(msg_a_pusch_time_domain_alloc_r16_present, 1));
  HANDLE_CODE(bref.unpack(start_symbol_and_len_msg_a_po_r16_present, 1));
  HANDLE_CODE(bref.unpack(map_type_msg_a_pusch_r16_present, 1));
  HANDLE_CODE(bref.unpack(guard_period_msg_a_pusch_r16_present, 1));
  HANDLE_CODE(bref.unpack(msg_a_intra_slot_freq_hop_r16_present, 1));
  HANDLE_CODE(bref.unpack(msg_a_hop_bits_r16_present, 1));
  HANDLE_CODE(bref.unpack(msg_a_alpha_r16_present, 1));
  HANDLE_CODE(bref.unpack(interlace_idx_first_po_msg_a_pusch_r16_present, 1));
  HANDLE_CODE(bref.unpack(nrof_interlaces_per_msg_a_po_r16_present, 1));

  HANDLE_CODE(unpack_integer(msg_a_mcs_r16, bref, (uint8_t)0u, (uint8_t)15u));
  HANDLE_CODE(unpack_integer(nrof_slots_msg_a_pusch_r16, bref, (uint8_t)1u, (uint8_t)4u));
  HANDLE_CODE(nrof_msg_a_po_per_slot_r16.unpack(bref));
  HANDLE_CODE(unpack_integer(msg_a_pusch_time_domain_offset_r16, bref, (uint8_t)1u, (uint8_t)32u));
  if (msg_a_pusch_time_domain_alloc_r16_present) {
    HANDLE_CODE(unpack_integer(msg_a_pusch_time_domain_alloc_r16, bref, (uint8_t)1u, (uint8_t)16u));
  }
  if (start_symbol_and_len_msg_a_po_r16_present) {
    HANDLE_CODE(unpack_integer(start_symbol_and_len_msg_a_po_r16, bref, (uint8_t)0u, (uint8_t)127u));
  }
  if (map_type_msg_a_pusch_r16_present) {
    HANDLE_CODE(map_type_msg_a_pusch_r16.unpack(bref));
  }
  if (guard_period_msg_a_pusch_r16_present) {
    HANDLE_CODE(unpack_integer(guard_period_msg_a_pusch_r16, bref, (uint8_t)0u, (uint8_t)3u));
  }
  HANDLE_CODE(unpack_integer(guard_band_msg_a_pusch_r16, bref, (uint8_t)0u, (uint8_t)1u));
  HANDLE_CODE(unpack_integer(freq_start_msg_a_pusch_r16, bref, (uint16_t)0u, (uint16_t)274u));
  HANDLE_CODE(unpack_integer(nrof_prbs_per_msg_a_po_r16, bref, (uint8_t)1u, (uint8_t)32u));
  HANDLE_CODE(nrof_msg_a_po_fdm_r16.unpack(bref));
  if (msg_a_hop_bits_r16_present) {
    HANDLE_CODE(msg_a_hop_bits_r16.unpack(bref));
  }
  HANDLE_CODE(msg_a_dmrs_cfg_r16.unpack(bref));
  HANDLE_CODE(unpack_integer(nrof_dmrs_seqs_r16, bref, (uint8_t)1u, (uint8_t)2u));
  if (msg_a_alpha_r16_present) {
    HANDLE_CODE(msg_a_alpha_r16.unpack(bref));
  }
  if (interlace_idx_first_po_msg_a_pusch_r16_present) {
    HANDLE_CODE(unpack_integer(interlace_idx_first_po_msg_a_pusch_r16, bref, (uint8_t)1u, (uint8_t)10u));
  }
  if (nrof_interlaces_per_msg_a_po_r16_present) {
    HANDLE_CODE(unpack_integer(nrof_interlaces_per_msg_a_po_r16, bref, (uint8_t)1u, (uint8_t)10u));
  }

  return SRSASN_SUCCESS;
}
void msg_a_pusch_res_r16_s::to_json(json_writer& j) const
{
  j.start_obj();
  j.write_int("msgA-MCS-r16", msg_a_mcs_r16);
  j.write_int("nrofSlotsMsgA-PUSCH-r16", nrof_slots_msg_a_pusch_r16);
  j.write_str("nrofMsgA-PO-PerSlot-r16", nrof_msg_a_po_per_slot_r16.to_string());
  j.write_int("msgA-PUSCH-TimeDomainOffset-r16", msg_a_pusch_time_domain_offset_r16);
  if (msg_a_pusch_time_domain_alloc_r16_present) {
    j.write_int("msgA-PUSCH-TimeDomainAllocation-r16", msg_a_pusch_time_domain_alloc_r16);
  }
  if (start_symbol_and_len_msg_a_po_r16_present) {
    j.write_int("startSymbolAndLengthMsgA-PO-r16", start_symbol_and_len_msg_a_po_r16);
  }
  if (map_type_msg_a_pusch_r16_present) {
    j.write_str("mappingTypeMsgA-PUSCH-r16", map_type_msg_a_pusch_r16.to_string());
  }
  if (guard_period_msg_a_pusch_r16_present) {
    j.write_int("guardPeriodMsgA-PUSCH-r16", guard_period_msg_a_pusch_r16);
  }
  j.write_int("guardBandMsgA-PUSCH-r16", guard_band_msg_a_pusch_r16);
  j.write_int("frequencyStartMsgA-PUSCH-r16", freq_start_msg_a_pusch_r16);
  j.write_int("nrofPRBs-PerMsgA-PO-r16", nrof_prbs_per_msg_a_po_r16);
  j.write_str("nrofMsgA-PO-FDM-r16", nrof_msg_a_po_fdm_r16.to_string());
  if (msg_a_intra_slot_freq_hop_r16_present) {
    j.write_str("msgA-IntraSlotFrequencyHopping-r16", "enabled");
  }
  if (msg_a_hop_bits_r16_present) {
    j.write_str("msgA-HoppingBits-r16", msg_a_hop_bits_r16.to_string());
  }
  j.write_fieldname("msgA-DMRS-Config-r16");
  msg_a_dmrs_cfg_r16.to_json(j);
  j.write_int("nrofDMRS-Sequences-r16", nrof_dmrs_seqs_r16);
  if (msg_a_alpha_r16_present) {
    j.write_str("msgA-Alpha-r16", msg_a_alpha_r16.to_string());
  }
  if (interlace_idx_first_po_msg_a_pusch_r16_present) {
    j.write_int("interlaceIndexFirstPO-MsgA-PUSCH-r16", interlace_idx_first_po_msg_a_pusch_r16);
  }
  if (nrof_interlaces_per_msg_a_po_r16_present) {
    j.write_int("nrofInterlacesPerMsgA-PO-r16", nrof_interlaces_per_msg_a_po_r16);
  }
  j.end_obj();
}

const char* msg_a_pusch_res_r16_s::nrof_msg_a_po_per_slot_r16_opts::to_string() const
{
  static const char* names[] = {"one", "two", "three", "six"};
  return convert_enum_idx(names, 4, value, "msg_a_pusch_res_r16_s::nrof_msg_a_po_per_slot_r16_e_");
}
uint8_t msg_a_pusch_res_r16_s::nrof_msg_a_po_per_slot_r16_opts::to_number() const
{
  static const uint8_t numbers[] = {1, 2, 3, 6};
  return map_enum_number(numbers, 4, value, "msg_a_pusch_res_r16_s::nrof_msg_a_po_per_slot_r16_e_");
}

const char* msg_a_pusch_res_r16_s::map_type_msg_a_pusch_r16_opts::to_string() const
{
  static const char* names[] = {"typeA", "typeB"};
  return convert_enum_idx(names, 2, value, "msg_a_pusch_res_r16_s::map_type_msg_a_pusch_r16_e_");
}

const char* msg_a_pusch_res_r16_s::nrof_msg_a_po_fdm_r16_opts::to_string() const
{
  static const char* names[] = {"one", "two", "four", "eight"};
  return convert_enum_idx(names, 4, value, "msg_a_pusch_res_r16_s::nrof_msg_a_po_fdm_r16_e_");
}
uint8_t msg_a_pusch_res_r16_s::nrof_msg_a_po_fdm_r16_opts::to_number() const
{
  static const uint8_t numbers[] = {1, 2, 4, 8};
  return map_enum_number(numbers, 4, value, "msg_a_pusch_res_r16_s::nrof_msg_a_po_fdm_r16_e_");
}

const char* msg_a_pusch_res_r16_s::msg_a_alpha_r16_opts::to_string() const
{
  static const char* names[] = {"alpha0", "alpha04", "alpha05", "alpha06", "alpha07", "alpha08", "alpha09", "alpha1"};
  return convert_enum_idx(names, 8, value, "msg_a_pusch_res_r16_s::msg_a_alpha_r16_e_");
}
float msg_a_pusch_res_r16_s::msg_a_alpha_r16_opts::to_number() const
{
  static const float numbers[] = {0.0, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0};
  return map_enum_number(numbers, 8, value, "msg_a_pusch_res_r16_s::msg_a_alpha_r16_e_");
}
const char* msg_a_pusch_res_r16_s::msg_a_alpha_r16_opts::to_number_string() const
{
  static const char* number_strs[] = {"0", "0.4", "0.5", "0.6", "0.7", "0.8", "0.9", "1"};
  return convert_enum_idx(number_strs, 8, value, "msg_a_pusch_res_r16_s::msg_a_alpha_r16_e_");
}

// RA-PrioritizationSliceInfo-r17 ::= SEQUENCE
SRSASN_CODE ra_prioritization_slice_info_r17_s::pack(bit_ref& bref) const
{
  bref.pack(ext, 1);
  HANDLE_CODE(pack_dyn_seq_of(bref, nsag_id_list_r17, 1, 8));
  HANDLE_CODE(ra_prioritization_r17.pack(bref));

  return SRSASN_SUCCESS;
}
SRSASN_CODE ra_prioritization_slice_info_r17_s::unpack(cbit_ref& bref)
{
  bref.unpack(ext, 1);
  HANDLE_CODE(unpack_dyn_seq_of(nsag_id_list_r17, bref, 1, 8));
  HANDLE_CODE(ra_prioritization_r17.unpack(bref));

  return SRSASN_SUCCESS;
}
void ra_prioritization_slice_info_r17_s::to_json(json_writer& j) const
{
  j.start_obj();
  j.start_array("nsag-ID-List-r17");
  for (const auto& e1 : nsag_id_list_r17) {
    j.write_str(e1.to_string());
  }
  j.end_array();
  j.write_fieldname("ra-Prioritization-r17");
  ra_prioritization_r17.to_json(j);
  j.end_obj();
}

// FeatureCombination-r17 ::= SEQUENCE
SRSASN_CODE feature_combination_r17_s::pack(bit_ref& bref) const
{
  HANDLE_CODE(bref.pack(red_cap_r17_present, 1));
  HANDLE_CODE(bref.pack(small_data_r17_present, 1));
  HANDLE_CODE(bref.pack(nsag_r17.size() > 0, 1));
  HANDLE_CODE(bref.pack(msg3_repeats_r17_present, 1));
  HANDLE_CODE(bref.pack(spare4_present, 1));
  HANDLE_CODE(bref.pack(spare3_present, 1));
  HANDLE_CODE(bref.pack(spare2_present, 1));
  HANDLE_CODE(bref.pack(spare1_present, 1));

  if (nsag_r17.size() > 0) {
    HANDLE_CODE(pack_dyn_seq_of(bref, nsag_r17, 1, 8));
  }

  return SRSASN_SUCCESS;
}
SRSASN_CODE feature_combination_r17_s::unpack(cbit_ref& bref)
{
  HANDLE_CODE(bref.unpack(red_cap_r17_present, 1));
  HANDLE_CODE(bref.unpack(small_data_r17_present, 1));
  bool nsag_r17_present;
  HANDLE_CODE(bref.unpack(nsag_r17_present, 1));
  HANDLE_CODE(bref.unpack(msg3_repeats_r17_present, 1));
  HANDLE_CODE(bref.unpack(spare4_present, 1));
  HANDLE_CODE(bref.unpack(spare3_present, 1));
  HANDLE_CODE(bref.unpack(spare2_present, 1));
  HANDLE_CODE(bref.unpack(spare1_present, 1));

  if (nsag_r17_present) {
    HANDLE_CODE(unpack_dyn_seq_of(nsag_r17, bref, 1, 8));
  }

  return SRSASN_SUCCESS;
}
void feature_combination_r17_s::to_json(json_writer& j) const
{
  j.start_obj();
  if (red_cap_r17_present) {
    j.write_str("redCap-r17", "true");
  }
  if (small_data_r17_present) {
    j.write_str("smallData-r17", "true");
  }
  if (nsag_r17.size() > 0) {
    j.start_array("nsag-r17");
    for (const auto& e1 : nsag_r17) {
      j.write_str(e1.to_string());
    }
    j.end_array();
  }
  if (msg3_repeats_r17_present) {
    j.write_str("msg3-Repetitions-r17", "true");
  }
  if (spare4_present) {
    j.write_str("spare4", "true");
  }
  if (spare3_present) {
    j.write_str("spare3", "true");
  }
  if (spare2_present) {
    j.write_str("spare2", "true");
  }
  if (spare1_present) {
    j.write_str("spare1", "true");
  }
  j.end_obj();
}

// MsgA-PUSCH-Config-r16 ::= SEQUENCE
SRSASN_CODE msg_a_pusch_cfg_r16_s::pack(bit_ref& bref) const
{
  HANDLE_CODE(bref.pack(msg_a_pusch_res_group_a_r16_present, 1));
  HANDLE_CODE(bref.pack(msg_a_pusch_res_group_b_r16_present, 1));
  HANDLE_CODE(bref.pack(msg_a_transform_precoder_r16_present, 1));
  HANDLE_CODE(bref.pack(msg_a_data_scrambling_idx_r16_present, 1));
  HANDLE_CODE(bref.pack(msg_a_delta_preamb_r16_present, 1));

  if (msg_a_pusch_res_group_a_r16_present) {
    HANDLE_CODE(msg_a_pusch_res_group_a_r16.pack(bref));
  }
  if (msg_a_pusch_res_group_b_r16_present) {
    HANDLE_CODE(msg_a_pusch_res_group_b_r16.pack(bref));
  }
  if (msg_a_transform_precoder_r16_present) {
    HANDLE_CODE(msg_a_transform_precoder_r16.pack(bref));
  }
  if (msg_a_data_scrambling_idx_r16_present) {
    HANDLE_CODE(pack_integer(bref, msg_a_data_scrambling_idx_r16, (uint16_t)0u, (uint16_t)1023u));
  }
  if (msg_a_delta_preamb_r16_present) {
    HANDLE_CODE(pack_integer(bref, msg_a_delta_preamb_r16, (int8_t)-1, (int8_t)6));
  }

  return SRSASN_SUCCESS;
}
SRSASN_CODE msg_a_pusch_cfg_r16_s::unpack(cbit_ref& bref)
{
  HANDLE_CODE(bref.unpack(msg_a_pusch_res_group_a_r16_present, 1));
  HANDLE_CODE(bref.unpack(msg_a_pusch_res_group_b_r16_present, 1));
  HANDLE_CODE(bref.unpack(msg_a_transform_precoder_r16_present, 1));
  HANDLE_CODE(bref.unpack(msg_a_data_scrambling_idx_r16_present, 1));
  HANDLE_CODE(bref.unpack(msg_a_delta_preamb_r16_present, 1));

  if (msg_a_pusch_res_group_a_r16_present) {
    HANDLE_CODE(msg_a_pusch_res_group_a_r16.unpack(bref));
  }
  if (msg_a_pusch_res_group_b_r16_present) {
    HANDLE_CODE(msg_a_pusch_res_group_b_r16.unpack(bref));
  }
  if (msg_a_transform_precoder_r16_present) {
    HANDLE_CODE(msg_a_transform_precoder_r16.unpack(bref));
  }
  if (msg_a_data_scrambling_idx_r16_present) {
    HANDLE_CODE(unpack_integer(msg_a_data_scrambling_idx_r16, bref, (uint16_t)0u, (uint16_t)1023u));
  }
  if (msg_a_delta_preamb_r16_present) {
    HANDLE_CODE(unpack_integer(msg_a_delta_preamb_r16, bref, (int8_t)-1, (int8_t)6));
  }

  return SRSASN_SUCCESS;
}
void msg_a_pusch_cfg_r16_s::to_json(json_writer& j) const
{
  j.start_obj();
  if (msg_a_pusch_res_group_a_r16_present) {
    j.write_fieldname("msgA-PUSCH-ResourceGroupA-r16");
    msg_a_pusch_res_group_a_r16.to_json(j);
  }
  if (msg_a_pusch_res_group_b_r16_present) {
    j.write_fieldname("msgA-PUSCH-ResourceGroupB-r16");
    msg_a_pusch_res_group_b_r16.to_json(j);
  }
  if (msg_a_transform_precoder_r16_present) {
    j.write_str("msgA-TransformPrecoder-r16", msg_a_transform_precoder_r16.to_string());
  }
  if (msg_a_data_scrambling_idx_r16_present) {
    j.write_int("msgA-DataScramblingIndex-r16", msg_a_data_scrambling_idx_r16);
  }
  if (msg_a_delta_preamb_r16_present) {
    j.write_int("msgA-DeltaPreamble-r16", msg_a_delta_preamb_r16);
  }
  j.end_obj();
}

const char* msg_a_pusch_cfg_r16_s::msg_a_transform_precoder_r16_opts::to_string() const
{
  static const char* names[] = {"enabled", "disabled"};
  return convert_enum_idx(names, 2, value, "msg_a_pusch_cfg_r16_s::msg_a_transform_precoder_r16_e_");
}

// FeatureCombinationPreambles-r17 ::= SEQUENCE
SRSASN_CODE feature_combination_preambs_r17_s::pack(bit_ref& bref) const
{
  bref.pack(ext, 1);
  HANDLE_CODE(bref.pack(ssb_shared_ro_mask_idx_r17_present, 1));
  HANDLE_CODE(bref.pack(group_bcfg_r17_present, 1));
  HANDLE_CODE(bref.pack(separate_msg_a_pusch_cfg_r17_present, 1));
  HANDLE_CODE(bref.pack(msg_a_rsrp_thres_r17_present, 1));
  HANDLE_CODE(bref.pack(rsrp_thres_ssb_r17_present, 1));
  HANDLE_CODE(bref.pack(delta_preamb_r17_present, 1));

  HANDLE_CODE(feature_combination_r17.pack(bref));
  HANDLE_CODE(pack_integer(bref, start_preamb_for_this_partition_r17, (uint8_t)0u, (uint8_t)63u));
  HANDLE_CODE(pack_integer(bref, nof_preambs_per_ssb_for_this_partition_r17, (uint8_t)1u, (uint8_t)64u));
  if (ssb_shared_ro_mask_idx_r17_present) {
    HANDLE_CODE(pack_integer(bref, ssb_shared_ro_mask_idx_r17, (uint8_t)1u, (uint8_t)15u));
  }
  if (group_bcfg_r17_present) {
    HANDLE_CODE(group_bcfg_r17.ra_size_group_a_r17.pack(bref));
    HANDLE_CODE(group_bcfg_r17.msg_pwr_offset_group_b_r17.pack(bref));
    HANDLE_CODE(pack_integer(bref, group_bcfg_r17.nof_ra_preambs_group_a_r17, (uint8_t)1u, (uint8_t)64u));
  }
  if (separate_msg_a_pusch_cfg_r17_present) {
    HANDLE_CODE(separate_msg_a_pusch_cfg_r17.pack(bref));
  }
  if (msg_a_rsrp_thres_r17_present) {
    HANDLE_CODE(pack_integer(bref, msg_a_rsrp_thres_r17, (uint8_t)0u, (uint8_t)127u));
  }
  if (rsrp_thres_ssb_r17_present) {
    HANDLE_CODE(pack_integer(bref, rsrp_thres_ssb_r17, (uint8_t)0u, (uint8_t)127u));
  }
  if (delta_preamb_r17_present) {
    HANDLE_CODE(pack_integer(bref, delta_preamb_r17, (int8_t)-1, (int8_t)6));
  }

  return SRSASN_SUCCESS;
}
SRSASN_CODE feature_combination_preambs_r17_s::unpack(cbit_ref& bref)
{
  bref.unpack(ext, 1);
  HANDLE_CODE(bref.unpack(ssb_shared_ro_mask_idx_r17_present, 1));
  HANDLE_CODE(bref.unpack(group_bcfg_r17_present, 1));
  HANDLE_CODE(bref.unpack(separate_msg_a_pusch_cfg_r17_present, 1));
  HANDLE_CODE(bref.unpack(msg_a_rsrp_thres_r17_present, 1));
  HANDLE_CODE(bref.unpack(rsrp_thres_ssb_r17_present, 1));
  HANDLE_CODE(bref.unpack(delta_preamb_r17_present, 1));

  HANDLE_CODE(feature_combination_r17.unpack(bref));
  HANDLE_CODE(unpack_integer(start_preamb_for_this_partition_r17, bref, (uint8_t)0u, (uint8_t)63u));
  HANDLE_CODE(unpack_integer(nof_preambs_per_ssb_for_this_partition_r17, bref, (uint8_t)1u, (uint8_t)64u));
  if (ssb_shared_ro_mask_idx_r17_present) {
    HANDLE_CODE(unpack_integer(ssb_shared_ro_mask_idx_r17, bref, (uint8_t)1u, (uint8_t)15u));
  }
  if (group_bcfg_r17_present) {
    HANDLE_CODE(group_bcfg_r17.ra_size_group_a_r17.unpack(bref));
    HANDLE_CODE(group_bcfg_r17.msg_pwr_offset_group_b_r17.unpack(bref));
    HANDLE_CODE(unpack_integer(group_bcfg_r17.nof_ra_preambs_group_a_r17, bref, (uint8_t)1u, (uint8_t)64u));
  }
  if (separate_msg_a_pusch_cfg_r17_present) {
    HANDLE_CODE(separate_msg_a_pusch_cfg_r17.unpack(bref));
  }
  if (msg_a_rsrp_thres_r17_present) {
    HANDLE_CODE(unpack_integer(msg_a_rsrp_thres_r17, bref, (uint8_t)0u, (uint8_t)127u));
  }
  if (rsrp_thres_ssb_r17_present) {
    HANDLE_CODE(unpack_integer(rsrp_thres_ssb_r17, bref, (uint8_t)0u, (uint8_t)127u));
  }
  if (delta_preamb_r17_present) {
    HANDLE_CODE(unpack_integer(delta_preamb_r17, bref, (int8_t)-1, (int8_t)6));
  }

  return SRSASN_SUCCESS;
}
void feature_combination_preambs_r17_s::to_json(json_writer& j) const
{
  j.start_obj();
  j.write_fieldname("featureCombination-r17");
  feature_combination_r17.to_json(j);
  j.write_int("startPreambleForThisPartition-r17", start_preamb_for_this_partition_r17);
  j.write_int("numberOfPreamblesPerSSB-ForThisPartition-r17", nof_preambs_per_ssb_for_this_partition_r17);
  if (ssb_shared_ro_mask_idx_r17_present) {
    j.write_int("ssb-SharedRO-MaskIndex-r17", ssb_shared_ro_mask_idx_r17);
  }
  if (group_bcfg_r17_present) {
    j.write_fieldname("groupBconfigured-r17");
    j.start_obj();
    j.write_str("ra-SizeGroupA-r17", group_bcfg_r17.ra_size_group_a_r17.to_string());
    j.write_str("messagePowerOffsetGroupB-r17", group_bcfg_r17.msg_pwr_offset_group_b_r17.to_string());
    j.write_int("numberOfRA-PreamblesGroupA-r17", group_bcfg_r17.nof_ra_preambs_group_a_r17);
    j.end_obj();
  }
  if (separate_msg_a_pusch_cfg_r17_present) {
    j.write_fieldname("separateMsgA-PUSCH-Config-r17");
    separate_msg_a_pusch_cfg_r17.to_json(j);
  }
  if (msg_a_rsrp_thres_r17_present) {
    j.write_int("msgA-RSRP-Threshold-r17", msg_a_rsrp_thres_r17);
  }
  if (rsrp_thres_ssb_r17_present) {
    j.write_int("rsrp-ThresholdSSB-r17", rsrp_thres_ssb_r17);
  }
  if (delta_preamb_r17_present) {
    j.write_int("deltaPreamble-r17", delta_preamb_r17);
  }
  j.end_obj();
}

const char* feature_combination_preambs_r17_s::group_bcfg_r17_s_::ra_size_group_a_r17_opts::to_string() const
{
  static const char* names[] = {"b56",
                                "b144",
                                "b208",
                                "b256",
                                "b282",
                                "b480",
                                "b640",
                                "b800",
                                "b1000",
                                "b72",
                                "spare6",
                                "spare5",
                                "spare4",
                                "spare3",
                                "spare2",
                                "spare1"};
  return convert_enum_idx(
      names, 16, value, "feature_combination_preambs_r17_s::group_bcfg_r17_s_::ra_size_group_a_r17_e_");
}
uint16_t feature_combination_preambs_r17_s::group_bcfg_r17_s_::ra_size_group_a_r17_opts::to_number() const
{
  static const uint16_t numbers[] = {56, 144, 208, 256, 282, 480, 640, 800, 1000, 72};
  return map_enum_number(
      numbers, 10, value, "feature_combination_preambs_r17_s::group_bcfg_r17_s_::ra_size_group_a_r17_e_");
}

const char* feature_combination_preambs_r17_s::group_bcfg_r17_s_::msg_pwr_offset_group_b_r17_opts::to_string() const
{
  static const char* names[] = {"minusinfinity", "dB0", "dB5", "dB8", "dB10", "dB12", "dB15", "dB18"};
  return convert_enum_idx(
      names, 8, value, "feature_combination_preambs_r17_s::group_bcfg_r17_s_::msg_pwr_offset_group_b_r17_e_");
}
int8_t feature_combination_preambs_r17_s::group_bcfg_r17_s_::msg_pwr_offset_group_b_r17_opts::to_number() const
{
  static const int8_t numbers[] = {-1, 0, 5, 8, 10, 12, 15, 18};
  return map_enum_number(
      numbers, 8, value, "feature_combination_preambs_r17_s::group_bcfg_r17_s_::msg_pwr_offset_group_b_r17_e_");
}

// GroupB-ConfiguredTwoStepRA-r16 ::= SEQUENCE
SRSASN_CODE group_b_cfg_two_step_ra_r16_s::pack(bit_ref& bref) const
{
  HANDLE_CODE(ra_msg_a_size_group_a.pack(bref));
  HANDLE_CODE(msg_pwr_offset_group_b.pack(bref));
  HANDLE_CODE(pack_integer(bref, nof_ra_preambs_group_a, (uint8_t)1u, (uint8_t)64u));

  return SRSASN_SUCCESS;
}
SRSASN_CODE group_b_cfg_two_step_ra_r16_s::unpack(cbit_ref& bref)
{
  HANDLE_CODE(ra_msg_a_size_group_a.unpack(bref));
  HANDLE_CODE(msg_pwr_offset_group_b.unpack(bref));
  HANDLE_CODE(unpack_integer(nof_ra_preambs_group_a, bref, (uint8_t)1u, (uint8_t)64u));

  return SRSASN_SUCCESS;
}
void group_b_cfg_two_step_ra_r16_s::to_json(json_writer& j) const
{
  j.start_obj();
  j.write_str("ra-MsgA-SizeGroupA", ra_msg_a_size_group_a.to_string());
  j.write_str("messagePowerOffsetGroupB", msg_pwr_offset_group_b.to_string());
  j.write_int("numberOfRA-PreamblesGroupA", nof_ra_preambs_group_a);
  j.end_obj();
}

const char* group_b_cfg_two_step_ra_r16_s::ra_msg_a_size_group_a_opts::to_string() const
{
  static const char* names[] = {"b56",
                                "b144",
                                "b208",
                                "b256",
                                "b282",
                                "b480",
                                "b640",
                                "b800",
                                "b1000",
                                "b72",
                                "spare6",
                                "spare5",
                                "spare4",
                                "spare3",
                                "spare2",
                                "spare1"};
  return convert_enum_idx(names, 16, value, "group_b_cfg_two_step_ra_r16_s::ra_msg_a_size_group_a_e_");
}
uint16_t group_b_cfg_two_step_ra_r16_s::ra_msg_a_size_group_a_opts::to_number() const
{
  static const uint16_t numbers[] = {56, 144, 208, 256, 282, 480, 640, 800, 1000, 72};
  return map_enum_number(numbers, 10, value, "group_b_cfg_two_step_ra_r16_s::ra_msg_a_size_group_a_e_");
}

const char* group_b_cfg_two_step_ra_r16_s::msg_pwr_offset_group_b_opts::to_string() const
{
  static const char* names[] = {"minusinfinity", "dB0", "dB5", "dB8", "dB10", "dB12", "dB15", "dB18"};
  return convert_enum_idx(names, 8, value, "group_b_cfg_two_step_ra_r16_s::msg_pwr_offset_group_b_e_");
}
int8_t group_b_cfg_two_step_ra_r16_s::msg_pwr_offset_group_b_opts::to_number() const
{
  static const int8_t numbers[] = {-1, 0, 5, 8, 10, 12, 15, 18};
  return map_enum_number(numbers, 8, value, "group_b_cfg_two_step_ra_r16_s::msg_pwr_offset_group_b_e_");
}

// RA-PrioritizationForSlicing-r17 ::= SEQUENCE
SRSASN_CODE ra_prioritization_for_slicing_r17_s::pack(bit_ref& bref) const
{
  bref.pack(ext, 1);
  HANDLE_CODE(pack_dyn_seq_of(bref, ra_prioritization_slice_info_list_r17, 1, 8));

  return SRSASN_SUCCESS;
}
SRSASN_CODE ra_prioritization_for_slicing_r17_s::unpack(cbit_ref& bref)
{
  bref.unpack(ext, 1);
  HANDLE_CODE(unpack_dyn_seq_of(ra_prioritization_slice_info_list_r17, bref, 1, 8));

  return SRSASN_SUCCESS;
}
void ra_prioritization_for_slicing_r17_s::to_json(json_writer& j) const
{
  j.start_obj();
  j.start_array("ra-PrioritizationSliceInfoList-r17");
  for (const auto& e1 : ra_prioritization_slice_info_list_r17) {
    e1.to_json(j);
  }
  j.end_array();
  j.end_obj();
}

// RACH-ConfigGenericTwoStepRA-r16 ::= SEQUENCE
SRSASN_CODE rach_cfg_generic_two_step_ra_r16_s::pack(bit_ref& bref) const
{
  bref.pack(ext, 1);
  HANDLE_CODE(bref.pack(msg_a_prach_cfg_idx_r16_present, 1));
  HANDLE_CODE(bref.pack(msg_a_ro_fdm_r16_present, 1));
  HANDLE_CODE(bref.pack(msg_a_ro_freq_start_r16_present, 1));
  HANDLE_CODE(bref.pack(msg_a_zero_correlation_zone_cfg_r16_present, 1));
  HANDLE_CODE(bref.pack(msg_a_preamb_pwr_ramp_step_r16_present, 1));
  HANDLE_CODE(bref.pack(msg_a_preamb_rx_target_pwr_r16_present, 1));
  HANDLE_CODE(bref.pack(msg_b_resp_win_r16_present, 1));
  HANDLE_CODE(bref.pack(preamb_trans_max_r16_present, 1));

  if (msg_a_prach_cfg_idx_r16_present) {
    HANDLE_CODE(pack_integer(bref, msg_a_prach_cfg_idx_r16, (uint16_t)0u, (uint16_t)262u));
  }
  if (msg_a_ro_fdm_r16_present) {
    HANDLE_CODE(msg_a_ro_fdm_r16.pack(bref));
  }
  if (msg_a_ro_freq_start_r16_present) {
    HANDLE_CODE(pack_integer(bref, msg_a_ro_freq_start_r16, (uint16_t)0u, (uint16_t)274u));
  }
  if (msg_a_zero_correlation_zone_cfg_r16_present) {
    HANDLE_CODE(pack_integer(bref, msg_a_zero_correlation_zone_cfg_r16, (uint8_t)0u, (uint8_t)15u));
  }
  if (msg_a_preamb_pwr_ramp_step_r16_present) {
    HANDLE_CODE(msg_a_preamb_pwr_ramp_step_r16.pack(bref));
  }
  if (msg_a_preamb_rx_target_pwr_r16_present) {
    HANDLE_CODE(pack_integer(bref, msg_a_preamb_rx_target_pwr_r16, (int16_t)-202, (int16_t)-60));
  }
  if (msg_b_resp_win_r16_present) {
    HANDLE_CODE(msg_b_resp_win_r16.pack(bref));
  }
  if (preamb_trans_max_r16_present) {
    HANDLE_CODE(preamb_trans_max_r16.pack(bref));
  }

  if (ext) {
    ext_groups_packer_guard group_flags;
    group_flags[0] |= msg_b_resp_win_v1700_present;
    group_flags.pack(bref);

    if (group_flags[0]) {
      varlength_field_pack_guard varlen_scope(bref, false);

      HANDLE_CODE(bref.pack(msg_b_resp_win_v1700_present, 1));
      if (msg_b_resp_win_v1700_present) {
        HANDLE_CODE(msg_b_resp_win_v1700.pack(bref));
      }
    }
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE rach_cfg_generic_two_step_ra_r16_s::unpack(cbit_ref& bref)
{
  bref.unpack(ext, 1);
  HANDLE_CODE(bref.unpack(msg_a_prach_cfg_idx_r16_present, 1));
  HANDLE_CODE(bref.unpack(msg_a_ro_fdm_r16_present, 1));
  HANDLE_CODE(bref.unpack(msg_a_ro_freq_start_r16_present, 1));
  HANDLE_CODE(bref.unpack(msg_a_zero_correlation_zone_cfg_r16_present, 1));
  HANDLE_CODE(bref.unpack(msg_a_preamb_pwr_ramp_step_r16_present, 1));
  HANDLE_CODE(bref.unpack(msg_a_preamb_rx_target_pwr_r16_present, 1));
  HANDLE_CODE(bref.unpack(msg_b_resp_win_r16_present, 1));
  HANDLE_CODE(bref.unpack(preamb_trans_max_r16_present, 1));

  if (msg_a_prach_cfg_idx_r16_present) {
    HANDLE_CODE(unpack_integer(msg_a_prach_cfg_idx_r16, bref, (uint16_t)0u, (uint16_t)262u));
  }
  if (msg_a_ro_fdm_r16_present) {
    HANDLE_CODE(msg_a_ro_fdm_r16.unpack(bref));
  }
  if (msg_a_ro_freq_start_r16_present) {
    HANDLE_CODE(unpack_integer(msg_a_ro_freq_start_r16, bref, (uint16_t)0u, (uint16_t)274u));
  }
  if (msg_a_zero_correlation_zone_cfg_r16_present) {
    HANDLE_CODE(unpack_integer(msg_a_zero_correlation_zone_cfg_r16, bref, (uint8_t)0u, (uint8_t)15u));
  }
  if (msg_a_preamb_pwr_ramp_step_r16_present) {
    HANDLE_CODE(msg_a_preamb_pwr_ramp_step_r16.unpack(bref));
  }
  if (msg_a_preamb_rx_target_pwr_r16_present) {
    HANDLE_CODE(unpack_integer(msg_a_preamb_rx_target_pwr_r16, bref, (int16_t)-202, (int16_t)-60));
  }
  if (msg_b_resp_win_r16_present) {
    HANDLE_CODE(msg_b_resp_win_r16.unpack(bref));
  }
  if (preamb_trans_max_r16_present) {
    HANDLE_CODE(preamb_trans_max_r16.unpack(bref));
  }

  if (ext) {
    ext_groups_unpacker_guard group_flags(1);
    group_flags.unpack(bref);

    if (group_flags[0]) {
      varlength_field_unpack_guard varlen_scope(bref, false);

      HANDLE_CODE(bref.unpack(msg_b_resp_win_v1700_present, 1));
      if (msg_b_resp_win_v1700_present) {
        HANDLE_CODE(msg_b_resp_win_v1700.unpack(bref));
      }
    }
  }
  return SRSASN_SUCCESS;
}
void rach_cfg_generic_two_step_ra_r16_s::to_json(json_writer& j) const
{
  j.start_obj();
  if (msg_a_prach_cfg_idx_r16_present) {
    j.write_int("msgA-PRACH-ConfigurationIndex-r16", msg_a_prach_cfg_idx_r16);
  }
  if (msg_a_ro_fdm_r16_present) {
    j.write_str("msgA-RO-FDM-r16", msg_a_ro_fdm_r16.to_string());
  }
  if (msg_a_ro_freq_start_r16_present) {
    j.write_int("msgA-RO-FrequencyStart-r16", msg_a_ro_freq_start_r16);
  }
  if (msg_a_zero_correlation_zone_cfg_r16_present) {
    j.write_int("msgA-ZeroCorrelationZoneConfig-r16", msg_a_zero_correlation_zone_cfg_r16);
  }
  if (msg_a_preamb_pwr_ramp_step_r16_present) {
    j.write_str("msgA-PreamblePowerRampingStep-r16", msg_a_preamb_pwr_ramp_step_r16.to_string());
  }
  if (msg_a_preamb_rx_target_pwr_r16_present) {
    j.write_int("msgA-PreambleReceivedTargetPower-r16", msg_a_preamb_rx_target_pwr_r16);
  }
  if (msg_b_resp_win_r16_present) {
    j.write_str("msgB-ResponseWindow-r16", msg_b_resp_win_r16.to_string());
  }
  if (preamb_trans_max_r16_present) {
    j.write_str("preambleTransMax-r16", preamb_trans_max_r16.to_string());
  }
  if (ext) {
    if (msg_b_resp_win_v1700_present) {
      j.write_str("msgB-ResponseWindow-v1700", msg_b_resp_win_v1700.to_string());
    }
  }
  j.end_obj();
}

const char* rach_cfg_generic_two_step_ra_r16_s::msg_a_ro_fdm_r16_opts::to_string() const
{
  static const char* names[] = {"one", "two", "four", "eight"};
  return convert_enum_idx(names, 4, value, "rach_cfg_generic_two_step_ra_r16_s::msg_a_ro_fdm_r16_e_");
}
uint8_t rach_cfg_generic_two_step_ra_r16_s::msg_a_ro_fdm_r16_opts::to_number() const
{
  static const uint8_t numbers[] = {1, 2, 4, 8};
  return map_enum_number(numbers, 4, value, "rach_cfg_generic_two_step_ra_r16_s::msg_a_ro_fdm_r16_e_");
}

const char* rach_cfg_generic_two_step_ra_r16_s::msg_a_preamb_pwr_ramp_step_r16_opts::to_string() const
{
  static const char* names[] = {"dB0", "dB2", "dB4", "dB6"};
  return convert_enum_idx(names, 4, value, "rach_cfg_generic_two_step_ra_r16_s::msg_a_preamb_pwr_ramp_step_r16_e_");
}
uint8_t rach_cfg_generic_two_step_ra_r16_s::msg_a_preamb_pwr_ramp_step_r16_opts::to_number() const
{
  static const uint8_t numbers[] = {0, 2, 4, 6};
  return map_enum_number(numbers, 4, value, "rach_cfg_generic_two_step_ra_r16_s::msg_a_preamb_pwr_ramp_step_r16_e_");
}

const char* rach_cfg_generic_two_step_ra_r16_s::msg_b_resp_win_r16_opts::to_string() const
{
  static const char* names[] = {"sl1", "sl2", "sl4", "sl8", "sl10", "sl20", "sl40", "sl80", "sl160", "sl320"};
  return convert_enum_idx(names, 10, value, "rach_cfg_generic_two_step_ra_r16_s::msg_b_resp_win_r16_e_");
}
uint16_t rach_cfg_generic_two_step_ra_r16_s::msg_b_resp_win_r16_opts::to_number() const
{
  static const uint16_t numbers[] = {1, 2, 4, 8, 10, 20, 40, 80, 160, 320};
  return map_enum_number(numbers, 10, value, "rach_cfg_generic_two_step_ra_r16_s::msg_b_resp_win_r16_e_");
}

const char* rach_cfg_generic_two_step_ra_r16_s::preamb_trans_max_r16_opts::to_string() const
{
  static const char* names[] = {"n3", "n4", "n5", "n6", "n7", "n8", "n10", "n20", "n50", "n100", "n200"};
  return convert_enum_idx(names, 11, value, "rach_cfg_generic_two_step_ra_r16_s::preamb_trans_max_r16_e_");
}
uint8_t rach_cfg_generic_two_step_ra_r16_s::preamb_trans_max_r16_opts::to_number() const
{
  static const uint8_t numbers[] = {3, 4, 5, 6, 7, 8, 10, 20, 50, 100, 200};
  return map_enum_number(numbers, 11, value, "rach_cfg_generic_two_step_ra_r16_s::preamb_trans_max_r16_e_");
}

const char* rach_cfg_generic_two_step_ra_r16_s::msg_b_resp_win_v1700_opts::to_string() const
{
  static const char* names[] = {"sl240", "sl640", "sl960", "sl1280", "sl1920", "sl2560"};
  return convert_enum_idx(names, 6, value, "rach_cfg_generic_two_step_ra_r16_s::msg_b_resp_win_v1700_e_");
}
uint16_t rach_cfg_generic_two_step_ra_r16_s::msg_b_resp_win_v1700_opts::to_number() const
{
  static const uint16_t numbers[] = {240, 640, 960, 1280, 1920, 2560};
  return map_enum_number(numbers, 6, value, "rach_cfg_generic_two_step_ra_r16_s::msg_b_resp_win_v1700_e_");
}

// RACH-ConfigCommonTwoStepRA-r16 ::= SEQUENCE
SRSASN_CODE rach_cfg_common_two_step_ra_r16_s::pack(bit_ref& bref) const
{
  bref.pack(ext, 1);
  HANDLE_CODE(bref.pack(msg_a_total_nof_ra_preambs_r16_present, 1));
  HANDLE_CODE(bref.pack(msg_a_ssb_per_rach_occasion_and_cb_preambs_per_ssb_r16_present, 1));
  HANDLE_CODE(bref.pack(msg_a_cb_preambs_per_ssb_per_shared_ro_r16_present, 1));
  HANDLE_CODE(bref.pack(msg_a_ssb_shared_ro_mask_idx_r16_present, 1));
  HANDLE_CODE(bref.pack(group_b_cfg_two_step_ra_r16_present, 1));
  HANDLE_CODE(bref.pack(msg_a_prach_root_seq_idx_r16_present, 1));
  HANDLE_CODE(bref.pack(msg_a_trans_max_r16_present, 1));
  HANDLE_CODE(bref.pack(msg_a_rsrp_thres_r16_present, 1));
  HANDLE_CODE(bref.pack(msg_a_rsrp_thres_ssb_r16_present, 1));
  HANDLE_CODE(bref.pack(msg_a_subcarrier_spacing_r16_present, 1));
  HANDLE_CODE(bref.pack(msg_a_restricted_set_cfg_r16_present, 1));
  HANDLE_CODE(bref.pack(ra_prioritization_for_access_id_two_step_r16_present, 1));
  HANDLE_CODE(bref.pack(ra_contention_resolution_timer_r16_present, 1));

  HANDLE_CODE(rach_cfg_generic_two_step_ra_r16.pack(bref));
  if (msg_a_total_nof_ra_preambs_r16_present) {
    HANDLE_CODE(pack_integer(bref, msg_a_total_nof_ra_preambs_r16, (uint8_t)1u, (uint8_t)63u));
  }
  if (msg_a_ssb_per_rach_occasion_and_cb_preambs_per_ssb_r16_present) {
    HANDLE_CODE(msg_a_ssb_per_rach_occasion_and_cb_preambs_per_ssb_r16.pack(bref));
  }
  if (msg_a_cb_preambs_per_ssb_per_shared_ro_r16_present) {
    HANDLE_CODE(pack_integer(bref, msg_a_cb_preambs_per_ssb_per_shared_ro_r16, (uint8_t)1u, (uint8_t)60u));
  }
  if (msg_a_ssb_shared_ro_mask_idx_r16_present) {
    HANDLE_CODE(pack_integer(bref, msg_a_ssb_shared_ro_mask_idx_r16, (uint8_t)1u, (uint8_t)15u));
  }
  if (group_b_cfg_two_step_ra_r16_present) {
    HANDLE_CODE(group_b_cfg_two_step_ra_r16.pack(bref));
  }
  if (msg_a_prach_root_seq_idx_r16_present) {
    HANDLE_CODE(msg_a_prach_root_seq_idx_r16.pack(bref));
  }
  if (msg_a_trans_max_r16_present) {
    HANDLE_CODE(msg_a_trans_max_r16.pack(bref));
  }
  if (msg_a_rsrp_thres_r16_present) {
    HANDLE_CODE(pack_integer(bref, msg_a_rsrp_thres_r16, (uint8_t)0u, (uint8_t)127u));
  }
  if (msg_a_rsrp_thres_ssb_r16_present) {
    HANDLE_CODE(pack_integer(bref, msg_a_rsrp_thres_ssb_r16, (uint8_t)0u, (uint8_t)127u));
  }
  if (msg_a_subcarrier_spacing_r16_present) {
    HANDLE_CODE(msg_a_subcarrier_spacing_r16.pack(bref));
  }
  if (msg_a_restricted_set_cfg_r16_present) {
    HANDLE_CODE(msg_a_restricted_set_cfg_r16.pack(bref));
  }
  if (ra_prioritization_for_access_id_two_step_r16_present) {
    HANDLE_CODE(ra_prioritization_for_access_id_two_step_r16.ra_prioritization_r16.pack(bref));
    HANDLE_CODE(ra_prioritization_for_access_id_two_step_r16.ra_prioritization_for_ai_r16.pack(bref));
  }
  if (ra_contention_resolution_timer_r16_present) {
    HANDLE_CODE(ra_contention_resolution_timer_r16.pack(bref));
  }

  if (ext) {
    ext_groups_packer_guard group_flags;
    group_flags[0] |= ra_prioritization_for_slicing_two_step_r17.is_present();
    group_flags[0] |= feature_combination_preambs_list_r17.is_present();
    group_flags.pack(bref);

    if (group_flags[0]) {
      varlength_field_pack_guard varlen_scope(bref, false);

      HANDLE_CODE(bref.pack(ra_prioritization_for_slicing_two_step_r17.is_present(), 1));
      HANDLE_CODE(bref.pack(feature_combination_preambs_list_r17.is_present(), 1));
      if (ra_prioritization_for_slicing_two_step_r17.is_present()) {
        HANDLE_CODE(ra_prioritization_for_slicing_two_step_r17->pack(bref));
      }
      if (feature_combination_preambs_list_r17.is_present()) {
        HANDLE_CODE(pack_dyn_seq_of(bref, *feature_combination_preambs_list_r17, 1, 256));
      }
    }
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE rach_cfg_common_two_step_ra_r16_s::unpack(cbit_ref& bref)
{
  bref.unpack(ext, 1);
  HANDLE_CODE(bref.unpack(msg_a_total_nof_ra_preambs_r16_present, 1));
  HANDLE_CODE(bref.unpack(msg_a_ssb_per_rach_occasion_and_cb_preambs_per_ssb_r16_present, 1));
  HANDLE_CODE(bref.unpack(msg_a_cb_preambs_per_ssb_per_shared_ro_r16_present, 1));
  HANDLE_CODE(bref.unpack(msg_a_ssb_shared_ro_mask_idx_r16_present, 1));
  HANDLE_CODE(bref.unpack(group_b_cfg_two_step_ra_r16_present, 1));
  HANDLE_CODE(bref.unpack(msg_a_prach_root_seq_idx_r16_present, 1));
  HANDLE_CODE(bref.unpack(msg_a_trans_max_r16_present, 1));
  HANDLE_CODE(bref.unpack(msg_a_rsrp_thres_r16_present, 1));
  HANDLE_CODE(bref.unpack(msg_a_rsrp_thres_ssb_r16_present, 1));
  HANDLE_CODE(bref.unpack(msg_a_subcarrier_spacing_r16_present, 1));
  HANDLE_CODE(bref.unpack(msg_a_restricted_set_cfg_r16_present, 1));
  HANDLE_CODE(bref.unpack(ra_prioritization_for_access_id_two_step_r16_present, 1));
  HANDLE_CODE(bref.unpack(ra_contention_resolution_timer_r16_present, 1));

  HANDLE_CODE(rach_cfg_generic_two_step_ra_r16.unpack(bref));
  if (msg_a_total_nof_ra_preambs_r16_present) {
    HANDLE_CODE(unpack_integer(msg_a_total_nof_ra_preambs_r16, bref, (uint8_t)1u, (uint8_t)63u));
  }
  if (msg_a_ssb_per_rach_occasion_and_cb_preambs_per_ssb_r16_present) {
    HANDLE_CODE(msg_a_ssb_per_rach_occasion_and_cb_preambs_per_ssb_r16.unpack(bref));
  }
  if (msg_a_cb_preambs_per_ssb_per_shared_ro_r16_present) {
    HANDLE_CODE(unpack_integer(msg_a_cb_preambs_per_ssb_per_shared_ro_r16, bref, (uint8_t)1u, (uint8_t)60u));
  }
  if (msg_a_ssb_shared_ro_mask_idx_r16_present) {
    HANDLE_CODE(unpack_integer(msg_a_ssb_shared_ro_mask_idx_r16, bref, (uint8_t)1u, (uint8_t)15u));
  }
  if (group_b_cfg_two_step_ra_r16_present) {
    HANDLE_CODE(group_b_cfg_two_step_ra_r16.unpack(bref));
  }
  if (msg_a_prach_root_seq_idx_r16_present) {
    HANDLE_CODE(msg_a_prach_root_seq_idx_r16.unpack(bref));
  }
  if (msg_a_trans_max_r16_present) {
    HANDLE_CODE(msg_a_trans_max_r16.unpack(bref));
  }
  if (msg_a_rsrp_thres_r16_present) {
    HANDLE_CODE(unpack_integer(msg_a_rsrp_thres_r16, bref, (uint8_t)0u, (uint8_t)127u));
  }
  if (msg_a_rsrp_thres_ssb_r16_present) {
    HANDLE_CODE(unpack_integer(msg_a_rsrp_thres_ssb_r16, bref, (uint8_t)0u, (uint8_t)127u));
  }
  if (msg_a_subcarrier_spacing_r16_present) {
    HANDLE_CODE(msg_a_subcarrier_spacing_r16.unpack(bref));
  }
  if (msg_a_restricted_set_cfg_r16_present) {
    HANDLE_CODE(msg_a_restricted_set_cfg_r16.unpack(bref));
  }
  if (ra_prioritization_for_access_id_two_step_r16_present) {
    HANDLE_CODE(ra_prioritization_for_access_id_two_step_r16.ra_prioritization_r16.unpack(bref));
    HANDLE_CODE(ra_prioritization_for_access_id_two_step_r16.ra_prioritization_for_ai_r16.unpack(bref));
  }
  if (ra_contention_resolution_timer_r16_present) {
    HANDLE_CODE(ra_contention_resolution_timer_r16.unpack(bref));
  }

  if (ext) {
    ext_groups_unpacker_guard group_flags(1);
    group_flags.unpack(bref);

    if (group_flags[0]) {
      varlength_field_unpack_guard varlen_scope(bref, false);

      unpack_presence_flag(ra_prioritization_for_slicing_two_step_r17, bref);
      unpack_presence_flag(feature_combination_preambs_list_r17, bref);
      if (ra_prioritization_for_slicing_two_step_r17.is_present()) {
        HANDLE_CODE(ra_prioritization_for_slicing_two_step_r17->unpack(bref));
      }
      if (feature_combination_preambs_list_r17.is_present()) {
        HANDLE_CODE(unpack_dyn_seq_of(*feature_combination_preambs_list_r17, bref, 1, 256));
      }
    }
  }
  return SRSASN_SUCCESS;
}
void rach_cfg_common_two_step_ra_r16_s::to_json(json_writer& j) const
{
  j.start_obj();
  j.write_fieldname("rach-ConfigGenericTwoStepRA-r16");
  rach_cfg_generic_two_step_ra_r16.to_json(j);
  if (msg_a_total_nof_ra_preambs_r16_present) {
    j.write_int("msgA-TotalNumberOfRA-Preambles-r16", msg_a_total_nof_ra_preambs_r16);
  }
  if (msg_a_ssb_per_rach_occasion_and_cb_preambs_per_ssb_r16_present) {
    j.write_fieldname("msgA-SSB-PerRACH-OccasionAndCB-PreamblesPerSSB-r16");
    msg_a_ssb_per_rach_occasion_and_cb_preambs_per_ssb_r16.to_json(j);
  }
  if (msg_a_cb_preambs_per_ssb_per_shared_ro_r16_present) {
    j.write_int("msgA-CB-PreamblesPerSSB-PerSharedRO-r16", msg_a_cb_preambs_per_ssb_per_shared_ro_r16);
  }
  if (msg_a_ssb_shared_ro_mask_idx_r16_present) {
    j.write_int("msgA-SSB-SharedRO-MaskIndex-r16", msg_a_ssb_shared_ro_mask_idx_r16);
  }
  if (group_b_cfg_two_step_ra_r16_present) {
    j.write_fieldname("groupB-ConfiguredTwoStepRA-r16");
    group_b_cfg_two_step_ra_r16.to_json(j);
  }
  if (msg_a_prach_root_seq_idx_r16_present) {
    j.write_fieldname("msgA-PRACH-RootSequenceIndex-r16");
    msg_a_prach_root_seq_idx_r16.to_json(j);
  }
  if (msg_a_trans_max_r16_present) {
    j.write_str("msgA-TransMax-r16", msg_a_trans_max_r16.to_string());
  }
  if (msg_a_rsrp_thres_r16_present) {
    j.write_int("msgA-RSRP-Threshold-r16", msg_a_rsrp_thres_r16);
  }
  if (msg_a_rsrp_thres_ssb_r16_present) {
    j.write_int("msgA-RSRP-ThresholdSSB-r16", msg_a_rsrp_thres_ssb_r16);
  }
  if (msg_a_subcarrier_spacing_r16_present) {
    j.write_str("msgA-SubcarrierSpacing-r16", msg_a_subcarrier_spacing_r16.to_string());
  }
  if (msg_a_restricted_set_cfg_r16_present) {
    j.write_str("msgA-RestrictedSetConfig-r16", msg_a_restricted_set_cfg_r16.to_string());
  }
  if (ra_prioritization_for_access_id_two_step_r16_present) {
    j.write_fieldname("ra-PrioritizationForAccessIdentityTwoStep-r16");
    j.start_obj();
    j.write_fieldname("ra-Prioritization-r16");
    ra_prioritization_for_access_id_two_step_r16.ra_prioritization_r16.to_json(j);
    j.write_str("ra-PrioritizationForAI-r16",
                ra_prioritization_for_access_id_two_step_r16.ra_prioritization_for_ai_r16.to_string());
    j.end_obj();
  }
  if (ra_contention_resolution_timer_r16_present) {
    j.write_str("ra-ContentionResolutionTimer-r16", ra_contention_resolution_timer_r16.to_string());
  }
  if (ext) {
    if (ra_prioritization_for_slicing_two_step_r17.is_present()) {
      j.write_fieldname("ra-PrioritizationForSlicingTwoStep-r17");
      ra_prioritization_for_slicing_two_step_r17->to_json(j);
    }
    if (feature_combination_preambs_list_r17.is_present()) {
      j.start_array("featureCombinationPreamblesList-r17");
      for (const auto& e1 : *feature_combination_preambs_list_r17) {
        e1.to_json(j);
      }
      j.end_array();
    }
  }
  j.end_obj();
}

void rach_cfg_common_two_step_ra_r16_s::msg_a_ssb_per_rach_occasion_and_cb_preambs_per_ssb_r16_c_::destroy_() {}
void rach_cfg_common_two_step_ra_r16_s::msg_a_ssb_per_rach_occasion_and_cb_preambs_per_ssb_r16_c_::set(types::options e)
{
  destroy_();
  type_ = e;
}
rach_cfg_common_two_step_ra_r16_s::msg_a_ssb_per_rach_occasion_and_cb_preambs_per_ssb_r16_c_::
    msg_a_ssb_per_rach_occasion_and_cb_preambs_per_ssb_r16_c_(
        const rach_cfg_common_two_step_ra_r16_s::msg_a_ssb_per_rach_occasion_and_cb_preambs_per_ssb_r16_c_& other)
{
  type_ = other.type();
  switch (type_) {
    case types::one_eighth:
      c.init(other.c.get<one_eighth_e_>());
      break;
    case types::one_fourth:
      c.init(other.c.get<one_fourth_e_>());
      break;
    case types::one_half:
      c.init(other.c.get<one_half_e_>());
      break;
    case types::one:
      c.init(other.c.get<one_e_>());
      break;
    case types::two:
      c.init(other.c.get<two_e_>());
      break;
    case types::four:
      c.init(other.c.get<uint8_t>());
      break;
    case types::eight:
      c.init(other.c.get<uint8_t>());
      break;
    case types::sixteen:
      c.init(other.c.get<uint8_t>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(
          type_, "rach_cfg_common_two_step_ra_r16_s::msg_a_ssb_per_rach_occasion_and_cb_preambs_per_ssb_r16_c_");
  }
}
rach_cfg_common_two_step_ra_r16_s::msg_a_ssb_per_rach_occasion_and_cb_preambs_per_ssb_r16_c_&
rach_cfg_common_two_step_ra_r16_s::msg_a_ssb_per_rach_occasion_and_cb_preambs_per_ssb_r16_c_::operator=(
    const rach_cfg_common_two_step_ra_r16_s::msg_a_ssb_per_rach_occasion_and_cb_preambs_per_ssb_r16_c_& other)
{
  if (this == &other) {
    return *this;
  }
  set(other.type());
  switch (type_) {
    case types::one_eighth:
      c.set(other.c.get<one_eighth_e_>());
      break;
    case types::one_fourth:
      c.set(other.c.get<one_fourth_e_>());
      break;
    case types::one_half:
      c.set(other.c.get<one_half_e_>());
      break;
    case types::one:
      c.set(other.c.get<one_e_>());
      break;
    case types::two:
      c.set(other.c.get<two_e_>());
      break;
    case types::four:
      c.set(other.c.get<uint8_t>());
      break;
    case types::eight:
      c.set(other.c.get<uint8_t>());
      break;
    case types::sixteen:
      c.set(other.c.get<uint8_t>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(
          type_, "rach_cfg_common_two_step_ra_r16_s::msg_a_ssb_per_rach_occasion_and_cb_preambs_per_ssb_r16_c_");
  }

  return *this;
}
rach_cfg_common_two_step_ra_r16_s::msg_a_ssb_per_rach_occasion_and_cb_preambs_per_ssb_r16_c_::one_eighth_e_&
rach_cfg_common_two_step_ra_r16_s::msg_a_ssb_per_rach_occasion_and_cb_preambs_per_ssb_r16_c_::set_one_eighth()
{
  set(types::one_eighth);
  return c.get<one_eighth_e_>();
}
rach_cfg_common_two_step_ra_r16_s::msg_a_ssb_per_rach_occasion_and_cb_preambs_per_ssb_r16_c_::one_fourth_e_&
rach_cfg_common_two_step_ra_r16_s::msg_a_ssb_per_rach_occasion_and_cb_preambs_per_ssb_r16_c_::set_one_fourth()
{
  set(types::one_fourth);
  return c.get<one_fourth_e_>();
}
rach_cfg_common_two_step_ra_r16_s::msg_a_ssb_per_rach_occasion_and_cb_preambs_per_ssb_r16_c_::one_half_e_&
rach_cfg_common_two_step_ra_r16_s::msg_a_ssb_per_rach_occasion_and_cb_preambs_per_ssb_r16_c_::set_one_half()
{
  set(types::one_half);
  return c.get<one_half_e_>();
}
rach_cfg_common_two_step_ra_r16_s::msg_a_ssb_per_rach_occasion_and_cb_preambs_per_ssb_r16_c_::one_e_&
rach_cfg_common_two_step_ra_r16_s::msg_a_ssb_per_rach_occasion_and_cb_preambs_per_ssb_r16_c_::set_one()
{
  set(types::one);
  return c.get<one_e_>();
}
rach_cfg_common_two_step_ra_r16_s::msg_a_ssb_per_rach_occasion_and_cb_preambs_per_ssb_r16_c_::two_e_&
rach_cfg_common_two_step_ra_r16_s::msg_a_ssb_per_rach_occasion_and_cb_preambs_per_ssb_r16_c_::set_two()
{
  set(types::two);
  return c.get<two_e_>();
}
uint8_t& rach_cfg_common_two_step_ra_r16_s::msg_a_ssb_per_rach_occasion_and_cb_preambs_per_ssb_r16_c_::set_four()
{
  set(types::four);
  return c.get<uint8_t>();
}
uint8_t& rach_cfg_common_two_step_ra_r16_s::msg_a_ssb_per_rach_occasion_and_cb_preambs_per_ssb_r16_c_::set_eight()
{
  set(types::eight);
  return c.get<uint8_t>();
}
uint8_t& rach_cfg_common_two_step_ra_r16_s::msg_a_ssb_per_rach_occasion_and_cb_preambs_per_ssb_r16_c_::set_sixteen()
{
  set(types::sixteen);
  return c.get<uint8_t>();
}
void rach_cfg_common_two_step_ra_r16_s::msg_a_ssb_per_rach_occasion_and_cb_preambs_per_ssb_r16_c_::to_json(
    json_writer& j) const
{
  j.start_obj();
  switch (type_) {
    case types::one_eighth:
      j.write_str("oneEighth", c.get<one_eighth_e_>().to_string());
      break;
    case types::one_fourth:
      j.write_str("oneFourth", c.get<one_fourth_e_>().to_string());
      break;
    case types::one_half:
      j.write_str("oneHalf", c.get<one_half_e_>().to_string());
      break;
    case types::one:
      j.write_str("one", c.get<one_e_>().to_string());
      break;
    case types::two:
      j.write_str("two", c.get<two_e_>().to_string());
      break;
    case types::four:
      j.write_int("four", c.get<uint8_t>());
      break;
    case types::eight:
      j.write_int("eight", c.get<uint8_t>());
      break;
    case types::sixteen:
      j.write_int("sixteen", c.get<uint8_t>());
      break;
    default:
      log_invalid_choice_id(
          type_, "rach_cfg_common_two_step_ra_r16_s::msg_a_ssb_per_rach_occasion_and_cb_preambs_per_ssb_r16_c_");
  }
  j.end_obj();
}
SRSASN_CODE
rach_cfg_common_two_step_ra_r16_s::msg_a_ssb_per_rach_occasion_and_cb_preambs_per_ssb_r16_c_::pack(bit_ref& bref) const
{
  type_.pack(bref);
  switch (type_) {
    case types::one_eighth:
      HANDLE_CODE(c.get<one_eighth_e_>().pack(bref));
      break;
    case types::one_fourth:
      HANDLE_CODE(c.get<one_fourth_e_>().pack(bref));
      break;
    case types::one_half:
      HANDLE_CODE(c.get<one_half_e_>().pack(bref));
      break;
    case types::one:
      HANDLE_CODE(c.get<one_e_>().pack(bref));
      break;
    case types::two:
      HANDLE_CODE(c.get<two_e_>().pack(bref));
      break;
    case types::four:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)1u, (uint8_t)16u));
      break;
    case types::eight:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)1u, (uint8_t)8u));
      break;
    case types::sixteen:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)1u, (uint8_t)4u));
      break;
    default:
      log_invalid_choice_id(
          type_, "rach_cfg_common_two_step_ra_r16_s::msg_a_ssb_per_rach_occasion_and_cb_preambs_per_ssb_r16_c_");
      return SRSASN_ERROR_ENCODE_FAIL;
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE
rach_cfg_common_two_step_ra_r16_s::msg_a_ssb_per_rach_occasion_and_cb_preambs_per_ssb_r16_c_::unpack(cbit_ref& bref)
{
  types e;
  e.unpack(bref);
  set(e);
  switch (type_) {
    case types::one_eighth:
      HANDLE_CODE(c.get<one_eighth_e_>().unpack(bref));
      break;
    case types::one_fourth:
      HANDLE_CODE(c.get<one_fourth_e_>().unpack(bref));
      break;
    case types::one_half:
      HANDLE_CODE(c.get<one_half_e_>().unpack(bref));
      break;
    case types::one:
      HANDLE_CODE(c.get<one_e_>().unpack(bref));
      break;
    case types::two:
      HANDLE_CODE(c.get<two_e_>().unpack(bref));
      break;
    case types::four:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)1u, (uint8_t)16u));
      break;
    case types::eight:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)1u, (uint8_t)8u));
      break;
    case types::sixteen:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)1u, (uint8_t)4u));
      break;
    default:
      log_invalid_choice_id(
          type_, "rach_cfg_common_two_step_ra_r16_s::msg_a_ssb_per_rach_occasion_and_cb_preambs_per_ssb_r16_c_");
      return SRSASN_ERROR_DECODE_FAIL;
  }
  return SRSASN_SUCCESS;
}

const char* rach_cfg_common_two_step_ra_r16_s::msg_a_ssb_per_rach_occasion_and_cb_preambs_per_ssb_r16_c_::
    one_eighth_opts::to_string() const
{
  static const char* names[] = {
      "n4", "n8", "n12", "n16", "n20", "n24", "n28", "n32", "n36", "n40", "n44", "n48", "n52", "n56", "n60", "n64"};
  return convert_enum_idx(
      names,
      16,
      value,
      "rach_cfg_common_two_step_ra_r16_s::msg_a_ssb_per_rach_occasion_and_cb_preambs_per_ssb_r16_c_::one_eighth_e_");
}
uint8_t rach_cfg_common_two_step_ra_r16_s::msg_a_ssb_per_rach_occasion_and_cb_preambs_per_ssb_r16_c_::one_eighth_opts::
    to_number() const
{
  static const uint8_t numbers[] = {4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 64};
  return map_enum_number(
      numbers,
      16,
      value,
      "rach_cfg_common_two_step_ra_r16_s::msg_a_ssb_per_rach_occasion_and_cb_preambs_per_ssb_r16_c_::one_eighth_e_");
}

const char* rach_cfg_common_two_step_ra_r16_s::msg_a_ssb_per_rach_occasion_and_cb_preambs_per_ssb_r16_c_::
    one_fourth_opts::to_string() const
{
  static const char* names[] = {
      "n4", "n8", "n12", "n16", "n20", "n24", "n28", "n32", "n36", "n40", "n44", "n48", "n52", "n56", "n60", "n64"};
  return convert_enum_idx(
      names,
      16,
      value,
      "rach_cfg_common_two_step_ra_r16_s::msg_a_ssb_per_rach_occasion_and_cb_preambs_per_ssb_r16_c_::one_fourth_e_");
}
uint8_t rach_cfg_common_two_step_ra_r16_s::msg_a_ssb_per_rach_occasion_and_cb_preambs_per_ssb_r16_c_::one_fourth_opts::
    to_number() const
{
  static const uint8_t numbers[] = {4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 64};
  return map_enum_number(
      numbers,
      16,
      value,
      "rach_cfg_common_two_step_ra_r16_s::msg_a_ssb_per_rach_occasion_and_cb_preambs_per_ssb_r16_c_::one_fourth_e_");
}

const char*
rach_cfg_common_two_step_ra_r16_s::msg_a_ssb_per_rach_occasion_and_cb_preambs_per_ssb_r16_c_::one_half_opts::to_string()
    const
{
  static const char* names[] = {
      "n4", "n8", "n12", "n16", "n20", "n24", "n28", "n32", "n36", "n40", "n44", "n48", "n52", "n56", "n60", "n64"};
  return convert_enum_idx(
      names,
      16,
      value,
      "rach_cfg_common_two_step_ra_r16_s::msg_a_ssb_per_rach_occasion_and_cb_preambs_per_ssb_r16_c_::one_half_e_");
}
uint8_t
rach_cfg_common_two_step_ra_r16_s::msg_a_ssb_per_rach_occasion_and_cb_preambs_per_ssb_r16_c_::one_half_opts::to_number()
    const
{
  static const uint8_t numbers[] = {4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 64};
  return map_enum_number(
      numbers,
      16,
      value,
      "rach_cfg_common_two_step_ra_r16_s::msg_a_ssb_per_rach_occasion_and_cb_preambs_per_ssb_r16_c_::one_half_e_");
}

const char*
rach_cfg_common_two_step_ra_r16_s::msg_a_ssb_per_rach_occasion_and_cb_preambs_per_ssb_r16_c_::one_opts::to_string()
    const
{
  static const char* names[] = {
      "n4", "n8", "n12", "n16", "n20", "n24", "n28", "n32", "n36", "n40", "n44", "n48", "n52", "n56", "n60", "n64"};
  return convert_enum_idx(
      names,
      16,
      value,
      "rach_cfg_common_two_step_ra_r16_s::msg_a_ssb_per_rach_occasion_and_cb_preambs_per_ssb_r16_c_::one_e_");
}
uint8_t
rach_cfg_common_two_step_ra_r16_s::msg_a_ssb_per_rach_occasion_and_cb_preambs_per_ssb_r16_c_::one_opts::to_number()
    const
{
  static const uint8_t numbers[] = {4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 64};
  return map_enum_number(
      numbers,
      16,
      value,
      "rach_cfg_common_two_step_ra_r16_s::msg_a_ssb_per_rach_occasion_and_cb_preambs_per_ssb_r16_c_::one_e_");
}

const char*
rach_cfg_common_two_step_ra_r16_s::msg_a_ssb_per_rach_occasion_and_cb_preambs_per_ssb_r16_c_::two_opts::to_string()
    const
{
  static const char* names[] = {"n4", "n8", "n12", "n16", "n20", "n24", "n28", "n32"};
  return convert_enum_idx(
      names,
      8,
      value,
      "rach_cfg_common_two_step_ra_r16_s::msg_a_ssb_per_rach_occasion_and_cb_preambs_per_ssb_r16_c_::two_e_");
}
uint8_t
rach_cfg_common_two_step_ra_r16_s::msg_a_ssb_per_rach_occasion_and_cb_preambs_per_ssb_r16_c_::two_opts::to_number()
    const
{
  static const uint8_t numbers[] = {4, 8, 12, 16, 20, 24, 28, 32};
  return map_enum_number(
      numbers,
      8,
      value,
      "rach_cfg_common_two_step_ra_r16_s::msg_a_ssb_per_rach_occasion_and_cb_preambs_per_ssb_r16_c_::two_e_");
}

const char*
rach_cfg_common_two_step_ra_r16_s::msg_a_ssb_per_rach_occasion_and_cb_preambs_per_ssb_r16_c_::types_opts::to_string()
    const
{
  static const char* names[] = {"oneEighth", "oneFourth", "oneHalf", "one", "two", "four", "eight", "sixteen"};
  return convert_enum_idx(
      names,
      8,
      value,
      "rach_cfg_common_two_step_ra_r16_s::msg_a_ssb_per_rach_occasion_and_cb_preambs_per_ssb_r16_c_::types");
}
float rach_cfg_common_two_step_ra_r16_s::msg_a_ssb_per_rach_occasion_and_cb_preambs_per_ssb_r16_c_::types_opts::
    to_number() const
{
  static const float numbers[] = {0.125, 0.25, 0.5, 1.0, 2.0, 4.0, 8.0, 6.0};
  return map_enum_number(
      numbers,
      8,
      value,
      "rach_cfg_common_two_step_ra_r16_s::msg_a_ssb_per_rach_occasion_and_cb_preambs_per_ssb_r16_c_::types");
}
const char* rach_cfg_common_two_step_ra_r16_s::msg_a_ssb_per_rach_occasion_and_cb_preambs_per_ssb_r16_c_::types_opts::
    to_number_string() const
{
  static const char* number_strs[] = {"1/8", "1/4", "1/2", "1", "2", "4", "8", "6"};
  return convert_enum_idx(
      number_strs,
      8,
      value,
      "rach_cfg_common_two_step_ra_r16_s::msg_a_ssb_per_rach_occasion_and_cb_preambs_per_ssb_r16_c_::types");
}

void rach_cfg_common_two_step_ra_r16_s::msg_a_prach_root_seq_idx_r16_c_::destroy_() {}
void rach_cfg_common_two_step_ra_r16_s::msg_a_prach_root_seq_idx_r16_c_::set(types::options e)
{
  destroy_();
  type_ = e;
}
rach_cfg_common_two_step_ra_r16_s::msg_a_prach_root_seq_idx_r16_c_::msg_a_prach_root_seq_idx_r16_c_(
    const rach_cfg_common_two_step_ra_r16_s::msg_a_prach_root_seq_idx_r16_c_& other)
{
  type_ = other.type();
  switch (type_) {
    case types::l839:
      c.init(other.c.get<uint16_t>());
      break;
    case types::l139:
      c.init(other.c.get<uint8_t>());
      break;
    case types::l571:
      c.init(other.c.get<uint16_t>());
      break;
    case types::l1151:
      c.init(other.c.get<uint16_t>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "rach_cfg_common_two_step_ra_r16_s::msg_a_prach_root_seq_idx_r16_c_");
  }
}
rach_cfg_common_two_step_ra_r16_s::msg_a_prach_root_seq_idx_r16_c_&
rach_cfg_common_two_step_ra_r16_s::msg_a_prach_root_seq_idx_r16_c_::operator=(
    const rach_cfg_common_two_step_ra_r16_s::msg_a_prach_root_seq_idx_r16_c_& other)
{
  if (this == &other) {
    return *this;
  }
  set(other.type());
  switch (type_) {
    case types::l839:
      c.set(other.c.get<uint16_t>());
      break;
    case types::l139:
      c.set(other.c.get<uint8_t>());
      break;
    case types::l571:
      c.set(other.c.get<uint16_t>());
      break;
    case types::l1151:
      c.set(other.c.get<uint16_t>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "rach_cfg_common_two_step_ra_r16_s::msg_a_prach_root_seq_idx_r16_c_");
  }

  return *this;
}
uint16_t& rach_cfg_common_two_step_ra_r16_s::msg_a_prach_root_seq_idx_r16_c_::set_l839()
{
  set(types::l839);
  return c.get<uint16_t>();
}
uint8_t& rach_cfg_common_two_step_ra_r16_s::msg_a_prach_root_seq_idx_r16_c_::set_l139()
{
  set(types::l139);
  return c.get<uint8_t>();
}
uint16_t& rach_cfg_common_two_step_ra_r16_s::msg_a_prach_root_seq_idx_r16_c_::set_l571()
{
  set(types::l571);
  return c.get<uint16_t>();
}
uint16_t& rach_cfg_common_two_step_ra_r16_s::msg_a_prach_root_seq_idx_r16_c_::set_l1151()
{
  set(types::l1151);
  return c.get<uint16_t>();
}
void rach_cfg_common_two_step_ra_r16_s::msg_a_prach_root_seq_idx_r16_c_::to_json(json_writer& j) const
{
  j.start_obj();
  switch (type_) {
    case types::l839:
      j.write_int("l839", c.get<uint16_t>());
      break;
    case types::l139:
      j.write_int("l139", c.get<uint8_t>());
      break;
    case types::l571:
      j.write_int("l571", c.get<uint16_t>());
      break;
    case types::l1151:
      j.write_int("l1151", c.get<uint16_t>());
      break;
    default:
      log_invalid_choice_id(type_, "rach_cfg_common_two_step_ra_r16_s::msg_a_prach_root_seq_idx_r16_c_");
  }
  j.end_obj();
}
SRSASN_CODE rach_cfg_common_two_step_ra_r16_s::msg_a_prach_root_seq_idx_r16_c_::pack(bit_ref& bref) const
{
  type_.pack(bref);
  switch (type_) {
    case types::l839:
      HANDLE_CODE(pack_integer(bref, c.get<uint16_t>(), (uint16_t)0u, (uint16_t)837u));
      break;
    case types::l139:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)137u));
      break;
    case types::l571:
      HANDLE_CODE(pack_integer(bref, c.get<uint16_t>(), (uint16_t)0u, (uint16_t)569u));
      break;
    case types::l1151:
      HANDLE_CODE(pack_integer(bref, c.get<uint16_t>(), (uint16_t)0u, (uint16_t)1149u));
      break;
    default:
      log_invalid_choice_id(type_, "rach_cfg_common_two_step_ra_r16_s::msg_a_prach_root_seq_idx_r16_c_");
      return SRSASN_ERROR_ENCODE_FAIL;
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE rach_cfg_common_two_step_ra_r16_s::msg_a_prach_root_seq_idx_r16_c_::unpack(cbit_ref& bref)
{
  types e;
  e.unpack(bref);
  set(e);
  switch (type_) {
    case types::l839:
      HANDLE_CODE(unpack_integer(c.get<uint16_t>(), bref, (uint16_t)0u, (uint16_t)837u));
      break;
    case types::l139:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)137u));
      break;
    case types::l571:
      HANDLE_CODE(unpack_integer(c.get<uint16_t>(), bref, (uint16_t)0u, (uint16_t)569u));
      break;
    case types::l1151:
      HANDLE_CODE(unpack_integer(c.get<uint16_t>(), bref, (uint16_t)0u, (uint16_t)1149u));
      break;
    default:
      log_invalid_choice_id(type_, "rach_cfg_common_two_step_ra_r16_s::msg_a_prach_root_seq_idx_r16_c_");
      return SRSASN_ERROR_DECODE_FAIL;
  }
  return SRSASN_SUCCESS;
}

const char* rach_cfg_common_two_step_ra_r16_s::msg_a_prach_root_seq_idx_r16_c_::types_opts::to_string() const
{
  static const char* names[] = {"l839", "l139", "l571", "l1151"};
  return convert_enum_idx(names, 4, value, "rach_cfg_common_two_step_ra_r16_s::msg_a_prach_root_seq_idx_r16_c_::types");
}
uint16_t rach_cfg_common_two_step_ra_r16_s::msg_a_prach_root_seq_idx_r16_c_::types_opts::to_number() const
{
  static const uint16_t numbers[] = {839, 139, 571, 1151};
  return map_enum_number(
      numbers, 4, value, "rach_cfg_common_two_step_ra_r16_s::msg_a_prach_root_seq_idx_r16_c_::types");
}

const char* rach_cfg_common_two_step_ra_r16_s::msg_a_trans_max_r16_opts::to_string() const
{
  static const char* names[] = {"n1", "n2", "n4", "n6", "n8", "n10", "n20", "n50", "n100", "n200"};
  return convert_enum_idx(names, 10, value, "rach_cfg_common_two_step_ra_r16_s::msg_a_trans_max_r16_e_");
}
uint8_t rach_cfg_common_two_step_ra_r16_s::msg_a_trans_max_r16_opts::to_number() const
{
  static const uint8_t numbers[] = {1, 2, 4, 6, 8, 10, 20, 50, 100, 200};
  return map_enum_number(numbers, 10, value, "rach_cfg_common_two_step_ra_r16_s::msg_a_trans_max_r16_e_");
}

const char* rach_cfg_common_two_step_ra_r16_s::msg_a_restricted_set_cfg_r16_opts::to_string() const
{
  static const char* names[] = {"unrestrictedSet", "restrictedSetTypeA", "restrictedSetTypeB"};
  return convert_enum_idx(names, 3, value, "rach_cfg_common_two_step_ra_r16_s::msg_a_restricted_set_cfg_r16_e_");
}

const char* rach_cfg_common_two_step_ra_r16_s::ra_contention_resolution_timer_r16_opts::to_string() const
{
  static const char* names[] = {"sf8", "sf16", "sf24", "sf32", "sf40", "sf48", "sf56", "sf64"};
  return convert_enum_idx(names, 8, value, "rach_cfg_common_two_step_ra_r16_s::ra_contention_resolution_timer_r16_e_");
}
uint8_t rach_cfg_common_two_step_ra_r16_s::ra_contention_resolution_timer_r16_opts::to_number() const
{
  static const uint8_t numbers[] = {8, 16, 24, 32, 40, 48, 56, 64};
  return map_enum_number(numbers, 8, value, "rach_cfg_common_two_step_ra_r16_s::ra_contention_resolution_timer_r16_e_");
}

// RACH-ConfigGeneric ::= SEQUENCE
SRSASN_CODE rach_cfg_generic_s::pack(bit_ref& bref) const
{
  bref.pack(ext, 1);
  HANDLE_CODE(pack_integer(bref, prach_cfg_idx, (uint16_t)0u, (uint16_t)255u));
  HANDLE_CODE(msg1_fdm.pack(bref));
  HANDLE_CODE(pack_integer(bref, msg1_freq_start, (uint16_t)0u, (uint16_t)274u));
  HANDLE_CODE(pack_integer(bref, zero_correlation_zone_cfg, (uint8_t)0u, (uint8_t)15u));
  HANDLE_CODE(pack_integer(bref, preamb_rx_target_pwr, (int16_t)-202, (int16_t)-60));
  HANDLE_CODE(preamb_trans_max.pack(bref));
  HANDLE_CODE(pwr_ramp_step.pack(bref));
  HANDLE_CODE(ra_resp_win.pack(bref));

  if (ext) {
    ext_groups_packer_guard group_flags;
    group_flags[0] |= prach_cfg_period_scaling_iab_r16_present;
    group_flags[0] |= prach_cfg_frame_offset_iab_r16_present;
    group_flags[0] |= prach_cfg_s_offset_iab_r16_present;
    group_flags[0] |= ra_resp_win_v1610_present;
    group_flags[0] |= prach_cfg_idx_v1610_present;
    group_flags[1] |= ra_resp_win_v1700_present;
    group_flags.pack(bref);

    if (group_flags[0]) {
      varlength_field_pack_guard varlen_scope(bref, false);

      HANDLE_CODE(bref.pack(prach_cfg_period_scaling_iab_r16_present, 1));
      HANDLE_CODE(bref.pack(prach_cfg_frame_offset_iab_r16_present, 1));
      HANDLE_CODE(bref.pack(prach_cfg_s_offset_iab_r16_present, 1));
      HANDLE_CODE(bref.pack(ra_resp_win_v1610_present, 1));
      HANDLE_CODE(bref.pack(prach_cfg_idx_v1610_present, 1));
      if (prach_cfg_period_scaling_iab_r16_present) {
        HANDLE_CODE(prach_cfg_period_scaling_iab_r16.pack(bref));
      }
      if (prach_cfg_frame_offset_iab_r16_present) {
        HANDLE_CODE(pack_integer(bref, prach_cfg_frame_offset_iab_r16, (uint8_t)0u, (uint8_t)63u));
      }
      if (prach_cfg_s_offset_iab_r16_present) {
        HANDLE_CODE(pack_integer(bref, prach_cfg_s_offset_iab_r16, (uint8_t)0u, (uint8_t)39u));
      }
      if (ra_resp_win_v1610_present) {
        HANDLE_CODE(ra_resp_win_v1610.pack(bref));
      }
      if (prach_cfg_idx_v1610_present) {
        HANDLE_CODE(pack_integer(bref, prach_cfg_idx_v1610, (uint16_t)256u, (uint16_t)262u));
      }
    }
    if (group_flags[1]) {
      varlength_field_pack_guard varlen_scope(bref, false);

      HANDLE_CODE(bref.pack(ra_resp_win_v1700_present, 1));
      if (ra_resp_win_v1700_present) {
        HANDLE_CODE(ra_resp_win_v1700.pack(bref));
      }
    }
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE rach_cfg_generic_s::unpack(cbit_ref& bref)
{
  bref.unpack(ext, 1);
  HANDLE_CODE(unpack_integer(prach_cfg_idx, bref, (uint16_t)0u, (uint16_t)255u));
  HANDLE_CODE(msg1_fdm.unpack(bref));
  HANDLE_CODE(unpack_integer(msg1_freq_start, bref, (uint16_t)0u, (uint16_t)274u));
  HANDLE_CODE(unpack_integer(zero_correlation_zone_cfg, bref, (uint8_t)0u, (uint8_t)15u));
  HANDLE_CODE(unpack_integer(preamb_rx_target_pwr, bref, (int16_t)-202, (int16_t)-60));
  HANDLE_CODE(preamb_trans_max.unpack(bref));
  HANDLE_CODE(pwr_ramp_step.unpack(bref));
  HANDLE_CODE(ra_resp_win.unpack(bref));

  if (ext) {
    ext_groups_unpacker_guard group_flags(2);
    group_flags.unpack(bref);

    if (group_flags[0]) {
      varlength_field_unpack_guard varlen_scope(bref, false);

      HANDLE_CODE(bref.unpack(prach_cfg_period_scaling_iab_r16_present, 1));
      HANDLE_CODE(bref.unpack(prach_cfg_frame_offset_iab_r16_present, 1));
      HANDLE_CODE(bref.unpack(prach_cfg_s_offset_iab_r16_present, 1));
      HANDLE_CODE(bref.unpack(ra_resp_win_v1610_present, 1));
      HANDLE_CODE(bref.unpack(prach_cfg_idx_v1610_present, 1));
      if (prach_cfg_period_scaling_iab_r16_present) {
        HANDLE_CODE(prach_cfg_period_scaling_iab_r16.unpack(bref));
      }
      if (prach_cfg_frame_offset_iab_r16_present) {
        HANDLE_CODE(unpack_integer(prach_cfg_frame_offset_iab_r16, bref, (uint8_t)0u, (uint8_t)63u));
      }
      if (prach_cfg_s_offset_iab_r16_present) {
        HANDLE_CODE(unpack_integer(prach_cfg_s_offset_iab_r16, bref, (uint8_t)0u, (uint8_t)39u));
      }
      if (ra_resp_win_v1610_present) {
        HANDLE_CODE(ra_resp_win_v1610.unpack(bref));
      }
      if (prach_cfg_idx_v1610_present) {
        HANDLE_CODE(unpack_integer(prach_cfg_idx_v1610, bref, (uint16_t)256u, (uint16_t)262u));
      }
    }
    if (group_flags[1]) {
      varlength_field_unpack_guard varlen_scope(bref, false);

      HANDLE_CODE(bref.unpack(ra_resp_win_v1700_present, 1));
      if (ra_resp_win_v1700_present) {
        HANDLE_CODE(ra_resp_win_v1700.unpack(bref));
      }
    }
  }
  return SRSASN_SUCCESS;
}
void rach_cfg_generic_s::to_json(json_writer& j) const
{
  j.start_obj();
  j.write_int("prach-ConfigurationIndex", prach_cfg_idx);
  j.write_str("msg1-FDM", msg1_fdm.to_string());
  j.write_int("msg1-FrequencyStart", msg1_freq_start);
  j.write_int("zeroCorrelationZoneConfig", zero_correlation_zone_cfg);
  j.write_int("preambleReceivedTargetPower", preamb_rx_target_pwr);
  j.write_str("preambleTransMax", preamb_trans_max.to_string());
  j.write_str("powerRampingStep", pwr_ramp_step.to_string());
  j.write_str("ra-ResponseWindow", ra_resp_win.to_string());
  if (ext) {
    if (prach_cfg_period_scaling_iab_r16_present) {
      j.write_str("prach-ConfigurationPeriodScaling-IAB-r16", prach_cfg_period_scaling_iab_r16.to_string());
    }
    if (prach_cfg_frame_offset_iab_r16_present) {
      j.write_int("prach-ConfigurationFrameOffset-IAB-r16", prach_cfg_frame_offset_iab_r16);
    }
    if (prach_cfg_s_offset_iab_r16_present) {
      j.write_int("prach-ConfigurationSOffset-IAB-r16", prach_cfg_s_offset_iab_r16);
    }
    if (ra_resp_win_v1610_present) {
      j.write_str("ra-ResponseWindow-v1610", ra_resp_win_v1610.to_string());
    }
    if (prach_cfg_idx_v1610_present) {
      j.write_int("prach-ConfigurationIndex-v1610", prach_cfg_idx_v1610);
    }
    if (ra_resp_win_v1700_present) {
      j.write_str("ra-ResponseWindow-v1700", ra_resp_win_v1700.to_string());
    }
  }
  j.end_obj();
}

const char* rach_cfg_generic_s::msg1_fdm_opts::to_string() const
{
  static const char* names[] = {"one", "two", "four", "eight"};
  return convert_enum_idx(names, 4, value, "rach_cfg_generic_s::msg1_fdm_e_");
}
uint8_t rach_cfg_generic_s::msg1_fdm_opts::to_number() const
{
  static const uint8_t numbers[] = {1, 2, 4, 8};
  return map_enum_number(numbers, 4, value, "rach_cfg_generic_s::msg1_fdm_e_");
}

const char* rach_cfg_generic_s::preamb_trans_max_opts::to_string() const
{
  static const char* names[] = {"n3", "n4", "n5", "n6", "n7", "n8", "n10", "n20", "n50", "n100", "n200"};
  return convert_enum_idx(names, 11, value, "rach_cfg_generic_s::preamb_trans_max_e_");
}
uint8_t rach_cfg_generic_s::preamb_trans_max_opts::to_number() const
{
  static const uint8_t numbers[] = {3, 4, 5, 6, 7, 8, 10, 20, 50, 100, 200};
  return map_enum_number(numbers, 11, value, "rach_cfg_generic_s::preamb_trans_max_e_");
}

const char* rach_cfg_generic_s::pwr_ramp_step_opts::to_string() const
{
  static const char* names[] = {"dB0", "dB2", "dB4", "dB6"};
  return convert_enum_idx(names, 4, value, "rach_cfg_generic_s::pwr_ramp_step_e_");
}
uint8_t rach_cfg_generic_s::pwr_ramp_step_opts::to_number() const
{
  static const uint8_t numbers[] = {0, 2, 4, 6};
  return map_enum_number(numbers, 4, value, "rach_cfg_generic_s::pwr_ramp_step_e_");
}

const char* rach_cfg_generic_s::ra_resp_win_opts::to_string() const
{
  static const char* names[] = {"sl1", "sl2", "sl4", "sl8", "sl10", "sl20", "sl40", "sl80"};
  return convert_enum_idx(names, 8, value, "rach_cfg_generic_s::ra_resp_win_e_");
}
uint8_t rach_cfg_generic_s::ra_resp_win_opts::to_number() const
{
  static const uint8_t numbers[] = {1, 2, 4, 8, 10, 20, 40, 80};
  return map_enum_number(numbers, 8, value, "rach_cfg_generic_s::ra_resp_win_e_");
}

const char* rach_cfg_generic_s::prach_cfg_period_scaling_iab_r16_opts::to_string() const
{
  static const char* names[] = {"scf1", "scf2", "scf4", "scf8", "scf16", "scf32", "scf64"};
  return convert_enum_idx(names, 7, value, "rach_cfg_generic_s::prach_cfg_period_scaling_iab_r16_e_");
}
uint8_t rach_cfg_generic_s::prach_cfg_period_scaling_iab_r16_opts::to_number() const
{
  static const uint8_t numbers[] = {1, 2, 4, 8, 16, 32, 64};
  return map_enum_number(numbers, 7, value, "rach_cfg_generic_s::prach_cfg_period_scaling_iab_r16_e_");
}

const char* rach_cfg_generic_s::ra_resp_win_v1610_opts::to_string() const
{
  static const char* names[] = {"sl60", "sl160"};
  return convert_enum_idx(names, 2, value, "rach_cfg_generic_s::ra_resp_win_v1610_e_");
}
uint8_t rach_cfg_generic_s::ra_resp_win_v1610_opts::to_number() const
{
  static const uint8_t numbers[] = {60, 160};
  return map_enum_number(numbers, 2, value, "rach_cfg_generic_s::ra_resp_win_v1610_e_");
}

const char* rach_cfg_generic_s::ra_resp_win_v1700_opts::to_string() const
{
  static const char* names[] = {"sl240", "sl320", "sl640", "sl960", "sl1280", "sl1920", "sl2560"};
  return convert_enum_idx(names, 7, value, "rach_cfg_generic_s::ra_resp_win_v1700_e_");
}
uint16_t rach_cfg_generic_s::ra_resp_win_v1700_opts::to_number() const
{
  static const uint16_t numbers[] = {240, 320, 640, 960, 1280, 1920, 2560};
  return map_enum_number(numbers, 7, value, "rach_cfg_generic_s::ra_resp_win_v1700_e_");
}

// MsgA-ConfigCommon-r16 ::= SEQUENCE
SRSASN_CODE msg_a_cfg_common_r16_s::pack(bit_ref& bref) const
{
  HANDLE_CODE(bref.pack(msg_a_pusch_cfg_r16_present, 1));

  HANDLE_CODE(rach_cfg_common_two_step_ra_r16.pack(bref));
  if (msg_a_pusch_cfg_r16_present) {
    HANDLE_CODE(msg_a_pusch_cfg_r16.pack(bref));
  }

  return SRSASN_SUCCESS;
}
SRSASN_CODE msg_a_cfg_common_r16_s::unpack(cbit_ref& bref)
{
  HANDLE_CODE(bref.unpack(msg_a_pusch_cfg_r16_present, 1));

  HANDLE_CODE(rach_cfg_common_two_step_ra_r16.unpack(bref));
  if (msg_a_pusch_cfg_r16_present) {
    HANDLE_CODE(msg_a_pusch_cfg_r16.unpack(bref));
  }

  return SRSASN_SUCCESS;
}
void msg_a_cfg_common_r16_s::to_json(json_writer& j) const
{
  j.start_obj();
  j.write_fieldname("rach-ConfigCommonTwoStepRA-r16");
  rach_cfg_common_two_step_ra_r16.to_json(j);
  if (msg_a_pusch_cfg_r16_present) {
    j.write_fieldname("msgA-PUSCH-Config-r16");
    msg_a_pusch_cfg_r16.to_json(j);
  }
  j.end_obj();
}

// PDSCH-TimeDomainResourceAllocation ::= SEQUENCE
SRSASN_CODE pdsch_time_domain_res_alloc_s::pack(bit_ref& bref) const
{
  HANDLE_CODE(bref.pack(k0_present, 1));

  if (k0_present) {
    HANDLE_CODE(pack_integer(bref, k0, (uint8_t)0u, (uint8_t)32u));
  }
  HANDLE_CODE(map_type.pack(bref));
  HANDLE_CODE(pack_integer(bref, start_symbol_and_len, (uint8_t)0u, (uint8_t)127u));

  return SRSASN_SUCCESS;
}
SRSASN_CODE pdsch_time_domain_res_alloc_s::unpack(cbit_ref& bref)
{
  HANDLE_CODE(bref.unpack(k0_present, 1));

  if (k0_present) {
    HANDLE_CODE(unpack_integer(k0, bref, (uint8_t)0u, (uint8_t)32u));
  }
  HANDLE_CODE(map_type.unpack(bref));
  HANDLE_CODE(unpack_integer(start_symbol_and_len, bref, (uint8_t)0u, (uint8_t)127u));

  return SRSASN_SUCCESS;
}
void pdsch_time_domain_res_alloc_s::to_json(json_writer& j) const
{
  j.start_obj();
  if (k0_present) {
    j.write_int("k0", k0);
  }
  j.write_str("mappingType", map_type.to_string());
  j.write_int("startSymbolAndLength", start_symbol_and_len);
  j.end_obj();
}

const char* pdsch_time_domain_res_alloc_s::map_type_opts::to_string() const
{
  static const char* names[] = {"typeA", "typeB"};
  return convert_enum_idx(names, 2, value, "pdsch_time_domain_res_alloc_s::map_type_e_");
}

// PDSCH-TimeDomainResourceAllocation-r16 ::= SEQUENCE
SRSASN_CODE pdsch_time_domain_res_alloc_r16_s::pack(bit_ref& bref) const
{
  bref.pack(ext, 1);
  HANDLE_CODE(bref.pack(k0_r16_present, 1));
  HANDLE_CODE(bref.pack(repeat_num_r16_present, 1));

  if (k0_r16_present) {
    HANDLE_CODE(pack_integer(bref, k0_r16, (uint8_t)0u, (uint8_t)32u));
  }
  HANDLE_CODE(map_type_r16.pack(bref));
  HANDLE_CODE(pack_integer(bref, start_symbol_and_len_r16, (uint8_t)0u, (uint8_t)127u));
  if (repeat_num_r16_present) {
    HANDLE_CODE(repeat_num_r16.pack(bref));
  }

  if (ext) {
    ext_groups_packer_guard group_flags;
    group_flags[0] |= k0_v1710_present;
    group_flags[1] |= repeat_num_v1730_present;
    group_flags.pack(bref);

    if (group_flags[0]) {
      varlength_field_pack_guard varlen_scope(bref, false);

      HANDLE_CODE(bref.pack(k0_v1710_present, 1));
      if (k0_v1710_present) {
        HANDLE_CODE(pack_integer(bref, k0_v1710, (uint8_t)33u, (uint8_t)128u));
      }
    }
    if (group_flags[1]) {
      varlength_field_pack_guard varlen_scope(bref, false);

      HANDLE_CODE(bref.pack(repeat_num_v1730_present, 1));
      if (repeat_num_v1730_present) {
        HANDLE_CODE(repeat_num_v1730.pack(bref));
      }
    }
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE pdsch_time_domain_res_alloc_r16_s::unpack(cbit_ref& bref)
{
  bref.unpack(ext, 1);
  HANDLE_CODE(bref.unpack(k0_r16_present, 1));
  HANDLE_CODE(bref.unpack(repeat_num_r16_present, 1));

  if (k0_r16_present) {
    HANDLE_CODE(unpack_integer(k0_r16, bref, (uint8_t)0u, (uint8_t)32u));
  }
  HANDLE_CODE(map_type_r16.unpack(bref));
  HANDLE_CODE(unpack_integer(start_symbol_and_len_r16, bref, (uint8_t)0u, (uint8_t)127u));
  if (repeat_num_r16_present) {
    HANDLE_CODE(repeat_num_r16.unpack(bref));
  }

  if (ext) {
    ext_groups_unpacker_guard group_flags(2);
    group_flags.unpack(bref);

    if (group_flags[0]) {
      varlength_field_unpack_guard varlen_scope(bref, false);

      HANDLE_CODE(bref.unpack(k0_v1710_present, 1));
      if (k0_v1710_present) {
        HANDLE_CODE(unpack_integer(k0_v1710, bref, (uint8_t)33u, (uint8_t)128u));
      }
    }
    if (group_flags[1]) {
      varlength_field_unpack_guard varlen_scope(bref, false);

      HANDLE_CODE(bref.unpack(repeat_num_v1730_present, 1));
      if (repeat_num_v1730_present) {
        HANDLE_CODE(repeat_num_v1730.unpack(bref));
      }
    }
  }
  return SRSASN_SUCCESS;
}
void pdsch_time_domain_res_alloc_r16_s::to_json(json_writer& j) const
{
  j.start_obj();
  if (k0_r16_present) {
    j.write_int("k0-r16", k0_r16);
  }
  j.write_str("mappingType-r16", map_type_r16.to_string());
  j.write_int("startSymbolAndLength-r16", start_symbol_and_len_r16);
  if (repeat_num_r16_present) {
    j.write_str("repetitionNumber-r16", repeat_num_r16.to_string());
  }
  if (ext) {
    if (k0_v1710_present) {
      j.write_int("k0-v1710", k0_v1710);
    }
    if (repeat_num_v1730_present) {
      j.write_str("repetitionNumber-v1730", repeat_num_v1730.to_string());
    }
  }
  j.end_obj();
}

const char* pdsch_time_domain_res_alloc_r16_s::map_type_r16_opts::to_string() const
{
  static const char* names[] = {"typeA", "typeB"};
  return convert_enum_idx(names, 2, value, "pdsch_time_domain_res_alloc_r16_s::map_type_r16_e_");
}

const char* pdsch_time_domain_res_alloc_r16_s::repeat_num_r16_opts::to_string() const
{
  static const char* names[] = {"n2", "n3", "n4", "n5", "n6", "n7", "n8", "n16"};
  return convert_enum_idx(names, 8, value, "pdsch_time_domain_res_alloc_r16_s::repeat_num_r16_e_");
}
uint8_t pdsch_time_domain_res_alloc_r16_s::repeat_num_r16_opts::to_number() const
{
  static const uint8_t numbers[] = {2, 3, 4, 5, 6, 7, 8, 16};
  return map_enum_number(numbers, 8, value, "pdsch_time_domain_res_alloc_r16_s::repeat_num_r16_e_");
}

const char* pdsch_time_domain_res_alloc_r16_s::repeat_num_v1730_opts::to_string() const
{
  static const char* names[] = {"n2", "n3", "n4", "n5", "n6", "n7", "n8", "n16"};
  return convert_enum_idx(names, 8, value, "pdsch_time_domain_res_alloc_r16_s::repeat_num_v1730_e_");
}
uint8_t pdsch_time_domain_res_alloc_r16_s::repeat_num_v1730_opts::to_number() const
{
  static const uint8_t numbers[] = {2, 3, 4, 5, 6, 7, 8, 16};
  return map_enum_number(numbers, 8, value, "pdsch_time_domain_res_alloc_r16_s::repeat_num_v1730_e_");
}

// PUSCH-TimeDomainResourceAllocation ::= SEQUENCE
SRSASN_CODE pusch_time_domain_res_alloc_s::pack(bit_ref& bref) const
{
  HANDLE_CODE(bref.pack(k2_present, 1));

  if (k2_present) {
    HANDLE_CODE(pack_integer(bref, k2, (uint8_t)0u, (uint8_t)32u));
  }
  HANDLE_CODE(map_type.pack(bref));
  HANDLE_CODE(pack_integer(bref, start_symbol_and_len, (uint8_t)0u, (uint8_t)127u));

  return SRSASN_SUCCESS;
}
SRSASN_CODE pusch_time_domain_res_alloc_s::unpack(cbit_ref& bref)
{
  HANDLE_CODE(bref.unpack(k2_present, 1));

  if (k2_present) {
    HANDLE_CODE(unpack_integer(k2, bref, (uint8_t)0u, (uint8_t)32u));
  }
  HANDLE_CODE(map_type.unpack(bref));
  HANDLE_CODE(unpack_integer(start_symbol_and_len, bref, (uint8_t)0u, (uint8_t)127u));

  return SRSASN_SUCCESS;
}
void pusch_time_domain_res_alloc_s::to_json(json_writer& j) const
{
  j.start_obj();
  if (k2_present) {
    j.write_int("k2", k2);
  }
  j.write_str("mappingType", map_type.to_string());
  j.write_int("startSymbolAndLength", start_symbol_and_len);
  j.end_obj();
}

const char* pusch_time_domain_res_alloc_s::map_type_opts::to_string() const
{
  static const char* names[] = {"typeA", "typeB"};
  return convert_enum_idx(names, 2, value, "pusch_time_domain_res_alloc_s::map_type_e_");
}

// RACH-ConfigCommon ::= SEQUENCE
SRSASN_CODE rach_cfg_common_s::pack(bit_ref& bref) const
{
  bref.pack(ext, 1);
  HANDLE_CODE(bref.pack(total_nof_ra_preambs_present, 1));
  HANDLE_CODE(bref.pack(ssb_per_rach_occasion_and_cb_preambs_per_ssb_present, 1));
  HANDLE_CODE(bref.pack(group_bcfg_present, 1));
  HANDLE_CODE(bref.pack(rsrp_thres_ssb_present, 1));
  HANDLE_CODE(bref.pack(rsrp_thres_ssb_sul_present, 1));
  HANDLE_CODE(bref.pack(msg1_subcarrier_spacing_present, 1));
  HANDLE_CODE(bref.pack(msg3_transform_precoder_present, 1));

  HANDLE_CODE(rach_cfg_generic.pack(bref));
  if (total_nof_ra_preambs_present) {
    HANDLE_CODE(pack_integer(bref, total_nof_ra_preambs, (uint8_t)1u, (uint8_t)63u));
  }
  if (ssb_per_rach_occasion_and_cb_preambs_per_ssb_present) {
    HANDLE_CODE(ssb_per_rach_occasion_and_cb_preambs_per_ssb.pack(bref));
  }
  if (group_bcfg_present) {
    HANDLE_CODE(group_bcfg.ra_msg3_size_group_a.pack(bref));
    HANDLE_CODE(group_bcfg.msg_pwr_offset_group_b.pack(bref));
    HANDLE_CODE(pack_integer(bref, group_bcfg.nof_ra_preambs_group_a, (uint8_t)1u, (uint8_t)64u));
  }
  HANDLE_CODE(ra_contention_resolution_timer.pack(bref));
  if (rsrp_thres_ssb_present) {
    HANDLE_CODE(pack_integer(bref, rsrp_thres_ssb, (uint8_t)0u, (uint8_t)127u));
  }
  if (rsrp_thres_ssb_sul_present) {
    HANDLE_CODE(pack_integer(bref, rsrp_thres_ssb_sul, (uint8_t)0u, (uint8_t)127u));
  }
  HANDLE_CODE(prach_root_seq_idx.pack(bref));
  if (msg1_subcarrier_spacing_present) {
    HANDLE_CODE(msg1_subcarrier_spacing.pack(bref));
  }
  HANDLE_CODE(restricted_set_cfg.pack(bref));

  if (ext) {
    ext_groups_packer_guard group_flags;
    group_flags[0] |= ra_prioritization_for_access_id_r16.is_present();
    group_flags[0] |= prach_root_seq_idx_r16.is_present();
    group_flags[1] |= ra_prioritization_for_slicing_r17.is_present();
    group_flags[1] |= feature_combination_preambs_list_r17.is_present();
    group_flags.pack(bref);

    if (group_flags[0]) {
      varlength_field_pack_guard varlen_scope(bref, false);

      HANDLE_CODE(bref.pack(ra_prioritization_for_access_id_r16.is_present(), 1));
      HANDLE_CODE(bref.pack(prach_root_seq_idx_r16.is_present(), 1));
      if (ra_prioritization_for_access_id_r16.is_present()) {
        HANDLE_CODE(ra_prioritization_for_access_id_r16->ra_prioritization_r16.pack(bref));
        HANDLE_CODE(ra_prioritization_for_access_id_r16->ra_prioritization_for_ai_r16.pack(bref));
      }
      if (prach_root_seq_idx_r16.is_present()) {
        HANDLE_CODE(prach_root_seq_idx_r16->pack(bref));
      }
    }
    if (group_flags[1]) {
      varlength_field_pack_guard varlen_scope(bref, false);

      HANDLE_CODE(bref.pack(ra_prioritization_for_slicing_r17.is_present(), 1));
      HANDLE_CODE(bref.pack(feature_combination_preambs_list_r17.is_present(), 1));
      if (ra_prioritization_for_slicing_r17.is_present()) {
        HANDLE_CODE(ra_prioritization_for_slicing_r17->pack(bref));
      }
      if (feature_combination_preambs_list_r17.is_present()) {
        HANDLE_CODE(pack_dyn_seq_of(bref, *feature_combination_preambs_list_r17, 1, 256));
      }
    }
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE rach_cfg_common_s::unpack(cbit_ref& bref)
{
  bref.unpack(ext, 1);
  HANDLE_CODE(bref.unpack(total_nof_ra_preambs_present, 1));
  HANDLE_CODE(bref.unpack(ssb_per_rach_occasion_and_cb_preambs_per_ssb_present, 1));
  HANDLE_CODE(bref.unpack(group_bcfg_present, 1));
  HANDLE_CODE(bref.unpack(rsrp_thres_ssb_present, 1));
  HANDLE_CODE(bref.unpack(rsrp_thres_ssb_sul_present, 1));
  HANDLE_CODE(bref.unpack(msg1_subcarrier_spacing_present, 1));
  HANDLE_CODE(bref.unpack(msg3_transform_precoder_present, 1));

  HANDLE_CODE(rach_cfg_generic.unpack(bref));
  if (total_nof_ra_preambs_present) {
    HANDLE_CODE(unpack_integer(total_nof_ra_preambs, bref, (uint8_t)1u, (uint8_t)63u));
  }
  if (ssb_per_rach_occasion_and_cb_preambs_per_ssb_present) {
    HANDLE_CODE(ssb_per_rach_occasion_and_cb_preambs_per_ssb.unpack(bref));
  }
  if (group_bcfg_present) {
    HANDLE_CODE(group_bcfg.ra_msg3_size_group_a.unpack(bref));
    HANDLE_CODE(group_bcfg.msg_pwr_offset_group_b.unpack(bref));
    HANDLE_CODE(unpack_integer(group_bcfg.nof_ra_preambs_group_a, bref, (uint8_t)1u, (uint8_t)64u));
  }
  HANDLE_CODE(ra_contention_resolution_timer.unpack(bref));
  if (rsrp_thres_ssb_present) {
    HANDLE_CODE(unpack_integer(rsrp_thres_ssb, bref, (uint8_t)0u, (uint8_t)127u));
  }
  if (rsrp_thres_ssb_sul_present) {
    HANDLE_CODE(unpack_integer(rsrp_thres_ssb_sul, bref, (uint8_t)0u, (uint8_t)127u));
  }
  HANDLE_CODE(prach_root_seq_idx.unpack(bref));
  if (msg1_subcarrier_spacing_present) {
    HANDLE_CODE(msg1_subcarrier_spacing.unpack(bref));
  }
  HANDLE_CODE(restricted_set_cfg.unpack(bref));

  if (ext) {
    ext_groups_unpacker_guard group_flags(2);
    group_flags.unpack(bref);

    if (group_flags[0]) {
      varlength_field_unpack_guard varlen_scope(bref, false);

      unpack_presence_flag(ra_prioritization_for_access_id_r16, bref);
      unpack_presence_flag(prach_root_seq_idx_r16, bref);
      if (ra_prioritization_for_access_id_r16.is_present()) {
        HANDLE_CODE(ra_prioritization_for_access_id_r16->ra_prioritization_r16.unpack(bref));
        HANDLE_CODE(ra_prioritization_for_access_id_r16->ra_prioritization_for_ai_r16.unpack(bref));
      }
      if (prach_root_seq_idx_r16.is_present()) {
        HANDLE_CODE(prach_root_seq_idx_r16->unpack(bref));
      }
    }
    if (group_flags[1]) {
      varlength_field_unpack_guard varlen_scope(bref, false);

      unpack_presence_flag(ra_prioritization_for_slicing_r17, bref);
      unpack_presence_flag(feature_combination_preambs_list_r17, bref);
      if (ra_prioritization_for_slicing_r17.is_present()) {
        HANDLE_CODE(ra_prioritization_for_slicing_r17->unpack(bref));
      }
      if (feature_combination_preambs_list_r17.is_present()) {
        HANDLE_CODE(unpack_dyn_seq_of(*feature_combination_preambs_list_r17, bref, 1, 256));
      }
    }
  }
  return SRSASN_SUCCESS;
}
void rach_cfg_common_s::to_json(json_writer& j) const
{
  j.start_obj();
  j.write_fieldname("rach-ConfigGeneric");
  rach_cfg_generic.to_json(j);
  if (total_nof_ra_preambs_present) {
    j.write_int("totalNumberOfRA-Preambles", total_nof_ra_preambs);
  }
  if (ssb_per_rach_occasion_and_cb_preambs_per_ssb_present) {
    j.write_fieldname("ssb-perRACH-OccasionAndCB-PreamblesPerSSB");
    ssb_per_rach_occasion_and_cb_preambs_per_ssb.to_json(j);
  }
  if (group_bcfg_present) {
    j.write_fieldname("groupBconfigured");
    j.start_obj();
    j.write_str("ra-Msg3SizeGroupA", group_bcfg.ra_msg3_size_group_a.to_string());
    j.write_str("messagePowerOffsetGroupB", group_bcfg.msg_pwr_offset_group_b.to_string());
    j.write_int("numberOfRA-PreamblesGroupA", group_bcfg.nof_ra_preambs_group_a);
    j.end_obj();
  }
  j.write_str("ra-ContentionResolutionTimer", ra_contention_resolution_timer.to_string());
  if (rsrp_thres_ssb_present) {
    j.write_int("rsrp-ThresholdSSB", rsrp_thres_ssb);
  }
  if (rsrp_thres_ssb_sul_present) {
    j.write_int("rsrp-ThresholdSSB-SUL", rsrp_thres_ssb_sul);
  }
  j.write_fieldname("prach-RootSequenceIndex");
  prach_root_seq_idx.to_json(j);
  if (msg1_subcarrier_spacing_present) {
    j.write_str("msg1-SubcarrierSpacing", msg1_subcarrier_spacing.to_string());
  }
  j.write_str("restrictedSetConfig", restricted_set_cfg.to_string());
  if (msg3_transform_precoder_present) {
    j.write_str("msg3-transformPrecoder", "enabled");
  }
  if (ext) {
    if (ra_prioritization_for_access_id_r16.is_present()) {
      j.write_fieldname("ra-PrioritizationForAccessIdentity-r16");
      j.start_obj();
      j.write_fieldname("ra-Prioritization-r16");
      ra_prioritization_for_access_id_r16->ra_prioritization_r16.to_json(j);
      j.write_str("ra-PrioritizationForAI-r16",
                  ra_prioritization_for_access_id_r16->ra_prioritization_for_ai_r16.to_string());
      j.end_obj();
    }
    if (prach_root_seq_idx_r16.is_present()) {
      j.write_fieldname("prach-RootSequenceIndex-r16");
      prach_root_seq_idx_r16->to_json(j);
    }
    if (ra_prioritization_for_slicing_r17.is_present()) {
      j.write_fieldname("ra-PrioritizationForSlicing-r17");
      ra_prioritization_for_slicing_r17->to_json(j);
    }
    if (feature_combination_preambs_list_r17.is_present()) {
      j.start_array("featureCombinationPreamblesList-r17");
      for (const auto& e1 : *feature_combination_preambs_list_r17) {
        e1.to_json(j);
      }
      j.end_array();
    }
  }
  j.end_obj();
}

void rach_cfg_common_s::ssb_per_rach_occasion_and_cb_preambs_per_ssb_c_::destroy_() {}
void rach_cfg_common_s::ssb_per_rach_occasion_and_cb_preambs_per_ssb_c_::set(types::options e)
{
  destroy_();
  type_ = e;
}
rach_cfg_common_s::ssb_per_rach_occasion_and_cb_preambs_per_ssb_c_::ssb_per_rach_occasion_and_cb_preambs_per_ssb_c_(
    const rach_cfg_common_s::ssb_per_rach_occasion_and_cb_preambs_per_ssb_c_& other)
{
  type_ = other.type();
  switch (type_) {
    case types::one_eighth:
      c.init(other.c.get<one_eighth_e_>());
      break;
    case types::one_fourth:
      c.init(other.c.get<one_fourth_e_>());
      break;
    case types::one_half:
      c.init(other.c.get<one_half_e_>());
      break;
    case types::one:
      c.init(other.c.get<one_e_>());
      break;
    case types::two:
      c.init(other.c.get<two_e_>());
      break;
    case types::four:
      c.init(other.c.get<uint8_t>());
      break;
    case types::eight:
      c.init(other.c.get<uint8_t>());
      break;
    case types::sixteen:
      c.init(other.c.get<uint8_t>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "rach_cfg_common_s::ssb_per_rach_occasion_and_cb_preambs_per_ssb_c_");
  }
}
rach_cfg_common_s::ssb_per_rach_occasion_and_cb_preambs_per_ssb_c_&
rach_cfg_common_s::ssb_per_rach_occasion_and_cb_preambs_per_ssb_c_::operator=(
    const rach_cfg_common_s::ssb_per_rach_occasion_and_cb_preambs_per_ssb_c_& other)
{
  if (this == &other) {
    return *this;
  }
  set(other.type());
  switch (type_) {
    case types::one_eighth:
      c.set(other.c.get<one_eighth_e_>());
      break;
    case types::one_fourth:
      c.set(other.c.get<one_fourth_e_>());
      break;
    case types::one_half:
      c.set(other.c.get<one_half_e_>());
      break;
    case types::one:
      c.set(other.c.get<one_e_>());
      break;
    case types::two:
      c.set(other.c.get<two_e_>());
      break;
    case types::four:
      c.set(other.c.get<uint8_t>());
      break;
    case types::eight:
      c.set(other.c.get<uint8_t>());
      break;
    case types::sixteen:
      c.set(other.c.get<uint8_t>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "rach_cfg_common_s::ssb_per_rach_occasion_and_cb_preambs_per_ssb_c_");
  }

  return *this;
}
rach_cfg_common_s::ssb_per_rach_occasion_and_cb_preambs_per_ssb_c_::one_eighth_e_&
rach_cfg_common_s::ssb_per_rach_occasion_and_cb_preambs_per_ssb_c_::set_one_eighth()
{
  set(types::one_eighth);
  return c.get<one_eighth_e_>();
}
rach_cfg_common_s::ssb_per_rach_occasion_and_cb_preambs_per_ssb_c_::one_fourth_e_&
rach_cfg_common_s::ssb_per_rach_occasion_and_cb_preambs_per_ssb_c_::set_one_fourth()
{
  set(types::one_fourth);
  return c.get<one_fourth_e_>();
}
rach_cfg_common_s::ssb_per_rach_occasion_and_cb_preambs_per_ssb_c_::one_half_e_&
rach_cfg_common_s::ssb_per_rach_occasion_and_cb_preambs_per_ssb_c_::set_one_half()
{
  set(types::one_half);
  return c.get<one_half_e_>();
}
rach_cfg_common_s::ssb_per_rach_occasion_and_cb_preambs_per_ssb_c_::one_e_&
rach_cfg_common_s::ssb_per_rach_occasion_and_cb_preambs_per_ssb_c_::set_one()
{
  set(types::one);
  return c.get<one_e_>();
}
rach_cfg_common_s::ssb_per_rach_occasion_and_cb_preambs_per_ssb_c_::two_e_&
rach_cfg_common_s::ssb_per_rach_occasion_and_cb_preambs_per_ssb_c_::set_two()
{
  set(types::two);
  return c.get<two_e_>();
}
uint8_t& rach_cfg_common_s::ssb_per_rach_occasion_and_cb_preambs_per_ssb_c_::set_four()
{
  set(types::four);
  return c.get<uint8_t>();
}
uint8_t& rach_cfg_common_s::ssb_per_rach_occasion_and_cb_preambs_per_ssb_c_::set_eight()
{
  set(types::eight);
  return c.get<uint8_t>();
}
uint8_t& rach_cfg_common_s::ssb_per_rach_occasion_and_cb_preambs_per_ssb_c_::set_sixteen()
{
  set(types::sixteen);
  return c.get<uint8_t>();
}
void rach_cfg_common_s::ssb_per_rach_occasion_and_cb_preambs_per_ssb_c_::to_json(json_writer& j) const
{
  j.start_obj();
  switch (type_) {
    case types::one_eighth:
      j.write_str("oneEighth", c.get<one_eighth_e_>().to_string());
      break;
    case types::one_fourth:
      j.write_str("oneFourth", c.get<one_fourth_e_>().to_string());
      break;
    case types::one_half:
      j.write_str("oneHalf", c.get<one_half_e_>().to_string());
      break;
    case types::one:
      j.write_str("one", c.get<one_e_>().to_string());
      break;
    case types::two:
      j.write_str("two", c.get<two_e_>().to_string());
      break;
    case types::four:
      j.write_int("four", c.get<uint8_t>());
      break;
    case types::eight:
      j.write_int("eight", c.get<uint8_t>());
      break;
    case types::sixteen:
      j.write_int("sixteen", c.get<uint8_t>());
      break;
    default:
      log_invalid_choice_id(type_, "rach_cfg_common_s::ssb_per_rach_occasion_and_cb_preambs_per_ssb_c_");
  }
  j.end_obj();
}
SRSASN_CODE rach_cfg_common_s::ssb_per_rach_occasion_and_cb_preambs_per_ssb_c_::pack(bit_ref& bref) const
{
  type_.pack(bref);
  switch (type_) {
    case types::one_eighth:
      HANDLE_CODE(c.get<one_eighth_e_>().pack(bref));
      break;
    case types::one_fourth:
      HANDLE_CODE(c.get<one_fourth_e_>().pack(bref));
      break;
    case types::one_half:
      HANDLE_CODE(c.get<one_half_e_>().pack(bref));
      break;
    case types::one:
      HANDLE_CODE(c.get<one_e_>().pack(bref));
      break;
    case types::two:
      HANDLE_CODE(c.get<two_e_>().pack(bref));
      break;
    case types::four:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)1u, (uint8_t)16u));
      break;
    case types::eight:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)1u, (uint8_t)8u));
      break;
    case types::sixteen:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)1u, (uint8_t)4u));
      break;
    default:
      log_invalid_choice_id(type_, "rach_cfg_common_s::ssb_per_rach_occasion_and_cb_preambs_per_ssb_c_");
      return SRSASN_ERROR_ENCODE_FAIL;
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE rach_cfg_common_s::ssb_per_rach_occasion_and_cb_preambs_per_ssb_c_::unpack(cbit_ref& bref)
{
  types e;
  e.unpack(bref);
  set(e);
  switch (type_) {
    case types::one_eighth:
      HANDLE_CODE(c.get<one_eighth_e_>().unpack(bref));
      break;
    case types::one_fourth:
      HANDLE_CODE(c.get<one_fourth_e_>().unpack(bref));
      break;
    case types::one_half:
      HANDLE_CODE(c.get<one_half_e_>().unpack(bref));
      break;
    case types::one:
      HANDLE_CODE(c.get<one_e_>().unpack(bref));
      break;
    case types::two:
      HANDLE_CODE(c.get<two_e_>().unpack(bref));
      break;
    case types::four:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)1u, (uint8_t)16u));
      break;
    case types::eight:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)1u, (uint8_t)8u));
      break;
    case types::sixteen:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)1u, (uint8_t)4u));
      break;
    default:
      log_invalid_choice_id(type_, "rach_cfg_common_s::ssb_per_rach_occasion_and_cb_preambs_per_ssb_c_");
      return SRSASN_ERROR_DECODE_FAIL;
  }
  return SRSASN_SUCCESS;
}

const char* rach_cfg_common_s::ssb_per_rach_occasion_and_cb_preambs_per_ssb_c_::one_eighth_opts::to_string() const
{
  static const char* names[] = {
      "n4", "n8", "n12", "n16", "n20", "n24", "n28", "n32", "n36", "n40", "n44", "n48", "n52", "n56", "n60", "n64"};
  return convert_enum_idx(
      names, 16, value, "rach_cfg_common_s::ssb_per_rach_occasion_and_cb_preambs_per_ssb_c_::one_eighth_e_");
}
uint8_t rach_cfg_common_s::ssb_per_rach_occasion_and_cb_preambs_per_ssb_c_::one_eighth_opts::to_number() const
{
  static const uint8_t numbers[] = {4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 64};
  return map_enum_number(
      numbers, 16, value, "rach_cfg_common_s::ssb_per_rach_occasion_and_cb_preambs_per_ssb_c_::one_eighth_e_");
}

const char* rach_cfg_common_s::ssb_per_rach_occasion_and_cb_preambs_per_ssb_c_::one_fourth_opts::to_string() const
{
  static const char* names[] = {
      "n4", "n8", "n12", "n16", "n20", "n24", "n28", "n32", "n36", "n40", "n44", "n48", "n52", "n56", "n60", "n64"};
  return convert_enum_idx(
      names, 16, value, "rach_cfg_common_s::ssb_per_rach_occasion_and_cb_preambs_per_ssb_c_::one_fourth_e_");
}
uint8_t rach_cfg_common_s::ssb_per_rach_occasion_and_cb_preambs_per_ssb_c_::one_fourth_opts::to_number() const
{
  static const uint8_t numbers[] = {4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 64};
  return map_enum_number(
      numbers, 16, value, "rach_cfg_common_s::ssb_per_rach_occasion_and_cb_preambs_per_ssb_c_::one_fourth_e_");
}

const char* rach_cfg_common_s::ssb_per_rach_occasion_and_cb_preambs_per_ssb_c_::one_half_opts::to_string() const
{
  static const char* names[] = {
      "n4", "n8", "n12", "n16", "n20", "n24", "n28", "n32", "n36", "n40", "n44", "n48", "n52", "n56", "n60", "n64"};
  return convert_enum_idx(
      names, 16, value, "rach_cfg_common_s::ssb_per_rach_occasion_and_cb_preambs_per_ssb_c_::one_half_e_");
}
uint8_t rach_cfg_common_s::ssb_per_rach_occasion_and_cb_preambs_per_ssb_c_::one_half_opts::to_number() const
{
  static const uint8_t numbers[] = {4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 64};
  return map_enum_number(
      numbers, 16, value, "rach_cfg_common_s::ssb_per_rach_occasion_and_cb_preambs_per_ssb_c_::one_half_e_");
}

const char* rach_cfg_common_s::ssb_per_rach_occasion_and_cb_preambs_per_ssb_c_::one_opts::to_string() const
{
  static const char* names[] = {
      "n4", "n8", "n12", "n16", "n20", "n24", "n28", "n32", "n36", "n40", "n44", "n48", "n52", "n56", "n60", "n64"};
  return convert_enum_idx(
      names, 16, value, "rach_cfg_common_s::ssb_per_rach_occasion_and_cb_preambs_per_ssb_c_::one_e_");
}
uint8_t rach_cfg_common_s::ssb_per_rach_occasion_and_cb_preambs_per_ssb_c_::one_opts::to_number() const
{
  static const uint8_t numbers[] = {4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 64};
  return map_enum_number(
      numbers, 16, value, "rach_cfg_common_s::ssb_per_rach_occasion_and_cb_preambs_per_ssb_c_::one_e_");
}

const char* rach_cfg_common_s::ssb_per_rach_occasion_and_cb_preambs_per_ssb_c_::two_opts::to_string() const
{
  static const char* names[] = {"n4", "n8", "n12", "n16", "n20", "n24", "n28", "n32"};
  return convert_enum_idx(
      names, 8, value, "rach_cfg_common_s::ssb_per_rach_occasion_and_cb_preambs_per_ssb_c_::two_e_");
}
uint8_t rach_cfg_common_s::ssb_per_rach_occasion_and_cb_preambs_per_ssb_c_::two_opts::to_number() const
{
  static const uint8_t numbers[] = {4, 8, 12, 16, 20, 24, 28, 32};
  return map_enum_number(
      numbers, 8, value, "rach_cfg_common_s::ssb_per_rach_occasion_and_cb_preambs_per_ssb_c_::two_e_");
}

const char* rach_cfg_common_s::ssb_per_rach_occasion_and_cb_preambs_per_ssb_c_::types_opts::to_string() const
{
  static const char* names[] = {"oneEighth", "oneFourth", "oneHalf", "one", "two", "four", "eight", "sixteen"};
  return convert_enum_idx(names, 8, value, "rach_cfg_common_s::ssb_per_rach_occasion_and_cb_preambs_per_ssb_c_::types");
}
float rach_cfg_common_s::ssb_per_rach_occasion_and_cb_preambs_per_ssb_c_::types_opts::to_number() const
{
  static const float numbers[] = {0.125, 0.25, 0.5, 1.0, 2.0, 4.0, 8.0, 6.0};
  return map_enum_number(
      numbers, 8, value, "rach_cfg_common_s::ssb_per_rach_occasion_and_cb_preambs_per_ssb_c_::types");
}
const char* rach_cfg_common_s::ssb_per_rach_occasion_and_cb_preambs_per_ssb_c_::types_opts::to_number_string() const
{
  static const char* number_strs[] = {"1/8", "1/4", "1/2", "1", "2", "4", "8", "6"};
  return convert_enum_idx(
      number_strs, 8, value, "rach_cfg_common_s::ssb_per_rach_occasion_and_cb_preambs_per_ssb_c_::types");
}

const char* rach_cfg_common_s::group_bcfg_s_::ra_msg3_size_group_a_opts::to_string() const
{
  static const char* names[] = {"b56",
                                "b144",
                                "b208",
                                "b256",
                                "b282",
                                "b480",
                                "b640",
                                "b800",
                                "b1000",
                                "b72",
                                "spare6",
                                "spare5",
                                "spare4",
                                "spare3",
                                "spare2",
                                "spare1"};
  return convert_enum_idx(names, 16, value, "rach_cfg_common_s::group_bcfg_s_::ra_msg3_size_group_a_e_");
}
uint16_t rach_cfg_common_s::group_bcfg_s_::ra_msg3_size_group_a_opts::to_number() const
{
  static const uint16_t numbers[] = {56, 144, 208, 256, 282, 480, 640, 800, 1000, 72};
  return map_enum_number(numbers, 10, value, "rach_cfg_common_s::group_bcfg_s_::ra_msg3_size_group_a_e_");
}

const char* rach_cfg_common_s::group_bcfg_s_::msg_pwr_offset_group_b_opts::to_string() const
{
  static const char* names[] = {"minusinfinity", "dB0", "dB5", "dB8", "dB10", "dB12", "dB15", "dB18"};
  return convert_enum_idx(names, 8, value, "rach_cfg_common_s::group_bcfg_s_::msg_pwr_offset_group_b_e_");
}
int8_t rach_cfg_common_s::group_bcfg_s_::msg_pwr_offset_group_b_opts::to_number() const
{
  static const int8_t numbers[] = {-1, 0, 5, 8, 10, 12, 15, 18};
  return map_enum_number(numbers, 8, value, "rach_cfg_common_s::group_bcfg_s_::msg_pwr_offset_group_b_e_");
}

const char* rach_cfg_common_s::ra_contention_resolution_timer_opts::to_string() const
{
  static const char* names[] = {"sf8", "sf16", "sf24", "sf32", "sf40", "sf48", "sf56", "sf64"};
  return convert_enum_idx(names, 8, value, "rach_cfg_common_s::ra_contention_resolution_timer_e_");
}
uint8_t rach_cfg_common_s::ra_contention_resolution_timer_opts::to_number() const
{
  static const uint8_t numbers[] = {8, 16, 24, 32, 40, 48, 56, 64};
  return map_enum_number(numbers, 8, value, "rach_cfg_common_s::ra_contention_resolution_timer_e_");
}

void rach_cfg_common_s::prach_root_seq_idx_c_::destroy_() {}
void rach_cfg_common_s::prach_root_seq_idx_c_::set(types::options e)
{
  destroy_();
  type_ = e;
}
rach_cfg_common_s::prach_root_seq_idx_c_::prach_root_seq_idx_c_(const rach_cfg_common_s::prach_root_seq_idx_c_& other)
{
  type_ = other.type();
  switch (type_) {
    case types::l839:
      c.init(other.c.get<uint16_t>());
      break;
    case types::l139:
      c.init(other.c.get<uint8_t>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "rach_cfg_common_s::prach_root_seq_idx_c_");
  }
}
rach_cfg_common_s::prach_root_seq_idx_c_&
rach_cfg_common_s::prach_root_seq_idx_c_::operator=(const rach_cfg_common_s::prach_root_seq_idx_c_& other)
{
  if (this == &other) {
    return *this;
  }
  set(other.type());
  switch (type_) {
    case types::l839:
      c.set(other.c.get<uint16_t>());
      break;
    case types::l139:
      c.set(other.c.get<uint8_t>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "rach_cfg_common_s::prach_root_seq_idx_c_");
  }

  return *this;
}
uint16_t& rach_cfg_common_s::prach_root_seq_idx_c_::set_l839()
{
  set(types::l839);
  return c.get<uint16_t>();
}
uint8_t& rach_cfg_common_s::prach_root_seq_idx_c_::set_l139()
{
  set(types::l139);
  return c.get<uint8_t>();
}
void rach_cfg_common_s::prach_root_seq_idx_c_::to_json(json_writer& j) const
{
  j.start_obj();
  switch (type_) {
    case types::l839:
      j.write_int("l839", c.get<uint16_t>());
      break;
    case types::l139:
      j.write_int("l139", c.get<uint8_t>());
      break;
    default:
      log_invalid_choice_id(type_, "rach_cfg_common_s::prach_root_seq_idx_c_");
  }
  j.end_obj();
}
SRSASN_CODE rach_cfg_common_s::prach_root_seq_idx_c_::pack(bit_ref& bref) const
{
  type_.pack(bref);
  switch (type_) {
    case types::l839:
      HANDLE_CODE(pack_integer(bref, c.get<uint16_t>(), (uint16_t)0u, (uint16_t)837u));
      break;
    case types::l139:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)137u));
      break;
    default:
      log_invalid_choice_id(type_, "rach_cfg_common_s::prach_root_seq_idx_c_");
      return SRSASN_ERROR_ENCODE_FAIL;
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE rach_cfg_common_s::prach_root_seq_idx_c_::unpack(cbit_ref& bref)
{
  types e;
  e.unpack(bref);
  set(e);
  switch (type_) {
    case types::l839:
      HANDLE_CODE(unpack_integer(c.get<uint16_t>(), bref, (uint16_t)0u, (uint16_t)837u));
      break;
    case types::l139:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)137u));
      break;
    default:
      log_invalid_choice_id(type_, "rach_cfg_common_s::prach_root_seq_idx_c_");
      return SRSASN_ERROR_DECODE_FAIL;
  }
  return SRSASN_SUCCESS;
}

const char* rach_cfg_common_s::prach_root_seq_idx_c_::types_opts::to_string() const
{
  static const char* names[] = {"l839", "l139"};
  return convert_enum_idx(names, 2, value, "rach_cfg_common_s::prach_root_seq_idx_c_::types");
}
uint16_t rach_cfg_common_s::prach_root_seq_idx_c_::types_opts::to_number() const
{
  static const uint16_t numbers[] = {839, 139};
  return map_enum_number(numbers, 2, value, "rach_cfg_common_s::prach_root_seq_idx_c_::types");
}

const char* rach_cfg_common_s::restricted_set_cfg_opts::to_string() const
{
  static const char* names[] = {"unrestrictedSet", "restrictedSetTypeA", "restrictedSetTypeB"};
  return convert_enum_idx(names, 3, value, "rach_cfg_common_s::restricted_set_cfg_e_");
}

void rach_cfg_common_s::prach_root_seq_idx_r16_c_::destroy_() {}
void rach_cfg_common_s::prach_root_seq_idx_r16_c_::set(types::options e)
{
  destroy_();
  type_ = e;
}
rach_cfg_common_s::prach_root_seq_idx_r16_c_::prach_root_seq_idx_r16_c_(
    const rach_cfg_common_s::prach_root_seq_idx_r16_c_& other)
{
  type_ = other.type();
  switch (type_) {
    case types::l571:
      c.init(other.c.get<uint16_t>());
      break;
    case types::l1151:
      c.init(other.c.get<uint16_t>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "rach_cfg_common_s::prach_root_seq_idx_r16_c_");
  }
}
rach_cfg_common_s::prach_root_seq_idx_r16_c_&
rach_cfg_common_s::prach_root_seq_idx_r16_c_::operator=(const rach_cfg_common_s::prach_root_seq_idx_r16_c_& other)
{
  if (this == &other) {
    return *this;
  }
  set(other.type());
  switch (type_) {
    case types::l571:
      c.set(other.c.get<uint16_t>());
      break;
    case types::l1151:
      c.set(other.c.get<uint16_t>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "rach_cfg_common_s::prach_root_seq_idx_r16_c_");
  }

  return *this;
}
uint16_t& rach_cfg_common_s::prach_root_seq_idx_r16_c_::set_l571()
{
  set(types::l571);
  return c.get<uint16_t>();
}
uint16_t& rach_cfg_common_s::prach_root_seq_idx_r16_c_::set_l1151()
{
  set(types::l1151);
  return c.get<uint16_t>();
}
void rach_cfg_common_s::prach_root_seq_idx_r16_c_::to_json(json_writer& j) const
{
  j.start_obj();
  switch (type_) {
    case types::l571:
      j.write_int("l571", c.get<uint16_t>());
      break;
    case types::l1151:
      j.write_int("l1151", c.get<uint16_t>());
      break;
    default:
      log_invalid_choice_id(type_, "rach_cfg_common_s::prach_root_seq_idx_r16_c_");
  }
  j.end_obj();
}
SRSASN_CODE rach_cfg_common_s::prach_root_seq_idx_r16_c_::pack(bit_ref& bref) const
{
  type_.pack(bref);
  switch (type_) {
    case types::l571:
      HANDLE_CODE(pack_integer(bref, c.get<uint16_t>(), (uint16_t)0u, (uint16_t)569u));
      break;
    case types::l1151:
      HANDLE_CODE(pack_integer(bref, c.get<uint16_t>(), (uint16_t)0u, (uint16_t)1149u));
      break;
    default:
      log_invalid_choice_id(type_, "rach_cfg_common_s::prach_root_seq_idx_r16_c_");
      return SRSASN_ERROR_ENCODE_FAIL;
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE rach_cfg_common_s::prach_root_seq_idx_r16_c_::unpack(cbit_ref& bref)
{
  types e;
  e.unpack(bref);
  set(e);
  switch (type_) {
    case types::l571:
      HANDLE_CODE(unpack_integer(c.get<uint16_t>(), bref, (uint16_t)0u, (uint16_t)569u));
      break;
    case types::l1151:
      HANDLE_CODE(unpack_integer(c.get<uint16_t>(), bref, (uint16_t)0u, (uint16_t)1149u));
      break;
    default:
      log_invalid_choice_id(type_, "rach_cfg_common_s::prach_root_seq_idx_r16_c_");
      return SRSASN_ERROR_DECODE_FAIL;
  }
  return SRSASN_SUCCESS;
}

const char* rach_cfg_common_s::prach_root_seq_idx_r16_c_::types_opts::to_string() const
{
  static const char* names[] = {"l571", "l1151"};
  return convert_enum_idx(names, 2, value, "rach_cfg_common_s::prach_root_seq_idx_r16_c_::types");
}
uint16_t rach_cfg_common_s::prach_root_seq_idx_r16_c_::types_opts::to_number() const
{
  static const uint16_t numbers[] = {571, 1151};
  return map_enum_number(numbers, 2, value, "rach_cfg_common_s::prach_root_seq_idx_r16_c_::types");
}

// AdditionalRACH-Config-r17 ::= SEQUENCE
SRSASN_CODE add_rach_cfg_r17_s::pack(bit_ref& bref) const
{
  bref.pack(ext, 1);
  HANDLE_CODE(bref.pack(rach_cfg_common_r17_present, 1));
  HANDLE_CODE(bref.pack(msg_a_cfg_common_r17_present, 1));

  if (rach_cfg_common_r17_present) {
    HANDLE_CODE(rach_cfg_common_r17.pack(bref));
  }
  if (msg_a_cfg_common_r17_present) {
    HANDLE_CODE(msg_a_cfg_common_r17.pack(bref));
  }

  return SRSASN_SUCCESS;
}
SRSASN_CODE add_rach_cfg_r17_s::unpack(cbit_ref& bref)
{
  bref.unpack(ext, 1);
  HANDLE_CODE(bref.unpack(rach_cfg_common_r17_present, 1));
  HANDLE_CODE(bref.unpack(msg_a_cfg_common_r17_present, 1));

  if (rach_cfg_common_r17_present) {
    HANDLE_CODE(rach_cfg_common_r17.unpack(bref));
  }
  if (msg_a_cfg_common_r17_present) {
    HANDLE_CODE(msg_a_cfg_common_r17.unpack(bref));
  }

  return SRSASN_SUCCESS;
}
void add_rach_cfg_r17_s::to_json(json_writer& j) const
{
  j.start_obj();
  if (rach_cfg_common_r17_present) {
    j.write_fieldname("rach-ConfigCommon-r17");
    rach_cfg_common_r17.to_json(j);
  }
  if (msg_a_cfg_common_r17_present) {
    j.write_fieldname("msgA-ConfigCommon-r17");
    msg_a_cfg_common_r17.to_json(j);
  }
  j.end_obj();
}

// ControlResourceSet ::= SEQUENCE
SRSASN_CODE coreset_s::pack(bit_ref& bref) const
{
  bref.pack(ext, 1);
  HANDLE_CODE(bref.pack(tci_states_pdcch_to_add_list.size() > 0, 1));
  HANDLE_CODE(bref.pack(tci_states_pdcch_to_release_list.size() > 0, 1));
  HANDLE_CODE(bref.pack(tci_present_in_dci_present, 1));
  HANDLE_CODE(bref.pack(pdcch_dmrs_scrambling_id_present, 1));

  HANDLE_CODE(pack_integer(bref, coreset_id, (uint8_t)0u, (uint8_t)11u));
  HANDLE_CODE(freq_domain_res.pack(bref));
  HANDLE_CODE(pack_integer(bref, dur, (uint8_t)1u, (uint8_t)3u));
  HANDLE_CODE(cce_reg_map_type.pack(bref));
  HANDLE_CODE(precoder_granularity.pack(bref));
  if (tci_states_pdcch_to_add_list.size() > 0) {
    HANDLE_CODE(pack_dyn_seq_of(bref, tci_states_pdcch_to_add_list, 1, 64, integer_packer<uint8_t>(0, 127)));
  }
  if (tci_states_pdcch_to_release_list.size() > 0) {
    HANDLE_CODE(pack_dyn_seq_of(bref, tci_states_pdcch_to_release_list, 1, 64, integer_packer<uint8_t>(0, 127)));
  }
  if (pdcch_dmrs_scrambling_id_present) {
    HANDLE_CODE(pack_integer(bref, pdcch_dmrs_scrambling_id, (uint32_t)0u, (uint32_t)65535u));
  }

  if (ext) {
    ext_groups_packer_guard group_flags;
    group_flags[0] |= rb_offset_r16_present;
    group_flags[0] |= tci_present_dci_1_2_r16_present;
    group_flags[0] |= coreset_pool_idx_r16_present;
    group_flags[0] |= coreset_id_v1610_present;
    group_flags[1] |= follow_unified_tci_state_r17_present;
    group_flags.pack(bref);

    if (group_flags[0]) {
      varlength_field_pack_guard varlen_scope(bref, false);

      HANDLE_CODE(bref.pack(rb_offset_r16_present, 1));
      HANDLE_CODE(bref.pack(tci_present_dci_1_2_r16_present, 1));
      HANDLE_CODE(bref.pack(coreset_pool_idx_r16_present, 1));
      HANDLE_CODE(bref.pack(coreset_id_v1610_present, 1));
      if (rb_offset_r16_present) {
        HANDLE_CODE(pack_integer(bref, rb_offset_r16, (uint8_t)0u, (uint8_t)5u));
      }
      if (tci_present_dci_1_2_r16_present) {
        HANDLE_CODE(pack_integer(bref, tci_present_dci_1_2_r16, (uint8_t)1u, (uint8_t)3u));
      }
      if (coreset_pool_idx_r16_present) {
        HANDLE_CODE(pack_integer(bref, coreset_pool_idx_r16, (uint8_t)0u, (uint8_t)1u));
      }
      if (coreset_id_v1610_present) {
        HANDLE_CODE(pack_integer(bref, coreset_id_v1610, (uint8_t)12u, (uint8_t)15u));
      }
    }
    if (group_flags[1]) {
      varlength_field_pack_guard varlen_scope(bref, false);

      HANDLE_CODE(bref.pack(follow_unified_tci_state_r17_present, 1));
    }
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE coreset_s::unpack(cbit_ref& bref)
{
  bref.unpack(ext, 1);
  bool tci_states_pdcch_to_add_list_present;
  HANDLE_CODE(bref.unpack(tci_states_pdcch_to_add_list_present, 1));
  bool tci_states_pdcch_to_release_list_present;
  HANDLE_CODE(bref.unpack(tci_states_pdcch_to_release_list_present, 1));
  HANDLE_CODE(bref.unpack(tci_present_in_dci_present, 1));
  HANDLE_CODE(bref.unpack(pdcch_dmrs_scrambling_id_present, 1));

  HANDLE_CODE(unpack_integer(coreset_id, bref, (uint8_t)0u, (uint8_t)11u));
  HANDLE_CODE(freq_domain_res.unpack(bref));
  HANDLE_CODE(unpack_integer(dur, bref, (uint8_t)1u, (uint8_t)3u));
  HANDLE_CODE(cce_reg_map_type.unpack(bref));
  HANDLE_CODE(precoder_granularity.unpack(bref));
  if (tci_states_pdcch_to_add_list_present) {
    HANDLE_CODE(unpack_dyn_seq_of(tci_states_pdcch_to_add_list, bref, 1, 64, integer_packer<uint8_t>(0, 127)));
  }
  if (tci_states_pdcch_to_release_list_present) {
    HANDLE_CODE(unpack_dyn_seq_of(tci_states_pdcch_to_release_list, bref, 1, 64, integer_packer<uint8_t>(0, 127)));
  }
  if (pdcch_dmrs_scrambling_id_present) {
    HANDLE_CODE(unpack_integer(pdcch_dmrs_scrambling_id, bref, (uint32_t)0u, (uint32_t)65535u));
  }

  if (ext) {
    ext_groups_unpacker_guard group_flags(2);
    group_flags.unpack(bref);

    if (group_flags[0]) {
      varlength_field_unpack_guard varlen_scope(bref, false);

      HANDLE_CODE(bref.unpack(rb_offset_r16_present, 1));
      HANDLE_CODE(bref.unpack(tci_present_dci_1_2_r16_present, 1));
      HANDLE_CODE(bref.unpack(coreset_pool_idx_r16_present, 1));
      HANDLE_CODE(bref.unpack(coreset_id_v1610_present, 1));
      if (rb_offset_r16_present) {
        HANDLE_CODE(unpack_integer(rb_offset_r16, bref, (uint8_t)0u, (uint8_t)5u));
      }
      if (tci_present_dci_1_2_r16_present) {
        HANDLE_CODE(unpack_integer(tci_present_dci_1_2_r16, bref, (uint8_t)1u, (uint8_t)3u));
      }
      if (coreset_pool_idx_r16_present) {
        HANDLE_CODE(unpack_integer(coreset_pool_idx_r16, bref, (uint8_t)0u, (uint8_t)1u));
      }
      if (coreset_id_v1610_present) {
        HANDLE_CODE(unpack_integer(coreset_id_v1610, bref, (uint8_t)12u, (uint8_t)15u));
      }
    }
    if (group_flags[1]) {
      varlength_field_unpack_guard varlen_scope(bref, false);

      HANDLE_CODE(bref.unpack(follow_unified_tci_state_r17_present, 1));
    }
  }
  return SRSASN_SUCCESS;
}
void coreset_s::to_json(json_writer& j) const
{
  j.start_obj();
  j.write_int("controlResourceSetId", coreset_id);
  j.write_str("frequencyDomainResources", freq_domain_res.to_string());
  j.write_int("duration", dur);
  j.write_fieldname("cce-REG-MappingType");
  cce_reg_map_type.to_json(j);
  j.write_str("precoderGranularity", precoder_granularity.to_string());
  if (tci_states_pdcch_to_add_list.size() > 0) {
    j.start_array("tci-StatesPDCCH-ToAddList");
    for (const auto& e1 : tci_states_pdcch_to_add_list) {
      j.write_int(e1);
    }
    j.end_array();
  }
  if (tci_states_pdcch_to_release_list.size() > 0) {
    j.start_array("tci-StatesPDCCH-ToReleaseList");
    for (const auto& e1 : tci_states_pdcch_to_release_list) {
      j.write_int(e1);
    }
    j.end_array();
  }
  if (tci_present_in_dci_present) {
    j.write_str("tci-PresentInDCI", "enabled");
  }
  if (pdcch_dmrs_scrambling_id_present) {
    j.write_int("pdcch-DMRS-ScramblingID", pdcch_dmrs_scrambling_id);
  }
  if (ext) {
    if (rb_offset_r16_present) {
      j.write_int("rb-Offset-r16", rb_offset_r16);
    }
    if (tci_present_dci_1_2_r16_present) {
      j.write_int("tci-PresentDCI-1-2-r16", tci_present_dci_1_2_r16);
    }
    if (coreset_pool_idx_r16_present) {
      j.write_int("coresetPoolIndex-r16", coreset_pool_idx_r16);
    }
    if (coreset_id_v1610_present) {
      j.write_int("controlResourceSetId-v1610", coreset_id_v1610);
    }
    if (follow_unified_tci_state_r17_present) {
      j.write_str("followUnifiedTCI-State-r17", "enabled");
    }
  }
  j.end_obj();
}

void coreset_s::cce_reg_map_type_c_::set(types::options e)
{
  type_ = e;
}
coreset_s::cce_reg_map_type_c_::interleaved_s_& coreset_s::cce_reg_map_type_c_::set_interleaved()
{
  set(types::interleaved);
  return c;
}
void coreset_s::cce_reg_map_type_c_::set_non_interleaved()
{
  set(types::non_interleaved);
}
void coreset_s::cce_reg_map_type_c_::to_json(json_writer& j) const
{
  j.start_obj();
  switch (type_) {
    case types::interleaved:
      j.write_fieldname("interleaved");
      j.start_obj();
      j.write_str("reg-BundleSize", c.reg_bundle_size.to_string());
      j.write_str("interleaverSize", c.interleaver_size.to_string());
      if (c.shift_idx_present) {
        j.write_int("shiftIndex", c.shift_idx);
      }
      j.end_obj();
      break;
    case types::non_interleaved:
      break;
    default:
      log_invalid_choice_id(type_, "coreset_s::cce_reg_map_type_c_");
  }
  j.end_obj();
}
SRSASN_CODE coreset_s::cce_reg_map_type_c_::pack(bit_ref& bref) const
{
  type_.pack(bref);
  switch (type_) {
    case types::interleaved:
      HANDLE_CODE(bref.pack(c.shift_idx_present, 1));
      HANDLE_CODE(c.reg_bundle_size.pack(bref));
      HANDLE_CODE(c.interleaver_size.pack(bref));
      if (c.shift_idx_present) {
        HANDLE_CODE(pack_integer(bref, c.shift_idx, (uint16_t)0u, (uint16_t)274u));
      }
      break;
    case types::non_interleaved:
      break;
    default:
      log_invalid_choice_id(type_, "coreset_s::cce_reg_map_type_c_");
      return SRSASN_ERROR_ENCODE_FAIL;
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE coreset_s::cce_reg_map_type_c_::unpack(cbit_ref& bref)
{
  types e;
  e.unpack(bref);
  set(e);
  switch (type_) {
    case types::interleaved:
      HANDLE_CODE(bref.unpack(c.shift_idx_present, 1));
      HANDLE_CODE(c.reg_bundle_size.unpack(bref));
      HANDLE_CODE(c.interleaver_size.unpack(bref));
      if (c.shift_idx_present) {
        HANDLE_CODE(unpack_integer(c.shift_idx, bref, (uint16_t)0u, (uint16_t)274u));
      }
      break;
    case types::non_interleaved:
      break;
    default:
      log_invalid_choice_id(type_, "coreset_s::cce_reg_map_type_c_");
      return SRSASN_ERROR_DECODE_FAIL;
  }
  return SRSASN_SUCCESS;
}

const char* coreset_s::cce_reg_map_type_c_::interleaved_s_::reg_bundle_size_opts::to_string() const
{
  static const char* names[] = {"n2", "n3", "n6"};
  return convert_enum_idx(names, 3, value, "coreset_s::cce_reg_map_type_c_::interleaved_s_::reg_bundle_size_e_");
}
uint8_t coreset_s::cce_reg_map_type_c_::interleaved_s_::reg_bundle_size_opts::to_number() const
{
  static const uint8_t numbers[] = {2, 3, 6};
  return map_enum_number(numbers, 3, value, "coreset_s::cce_reg_map_type_c_::interleaved_s_::reg_bundle_size_e_");
}

const char* coreset_s::cce_reg_map_type_c_::interleaved_s_::interleaver_size_opts::to_string() const
{
  static const char* names[] = {"n2", "n3", "n6"};
  return convert_enum_idx(names, 3, value, "coreset_s::cce_reg_map_type_c_::interleaved_s_::interleaver_size_e_");
}
uint8_t coreset_s::cce_reg_map_type_c_::interleaved_s_::interleaver_size_opts::to_number() const
{
  static const uint8_t numbers[] = {2, 3, 6};
  return map_enum_number(numbers, 3, value, "coreset_s::cce_reg_map_type_c_::interleaved_s_::interleaver_size_e_");
}

const char* coreset_s::cce_reg_map_type_c_::types_opts::to_string() const
{
  static const char* names[] = {"interleaved", "nonInterleaved"};
  return convert_enum_idx(names, 2, value, "coreset_s::cce_reg_map_type_c_::types");
}

const char* coreset_s::precoder_granularity_opts::to_string() const
{
  static const char* names[] = {"sameAsREG-bundle", "allContiguousRBs"};
  return convert_enum_idx(names, 2, value, "coreset_s::precoder_granularity_e_");
}

// RateMatchPattern ::= SEQUENCE
SRSASN_CODE rate_match_pattern_s::pack(bit_ref& bref) const
{
  bref.pack(ext, 1);
  HANDLE_CODE(bref.pack(subcarrier_spacing_present, 1));

  HANDLE_CODE(pack_integer(bref, rate_match_pattern_id, (uint8_t)0u, (uint8_t)3u));
  HANDLE_CODE(pattern_type.pack(bref));
  if (subcarrier_spacing_present) {
    HANDLE_CODE(subcarrier_spacing.pack(bref));
  }
  HANDLE_CODE(dummy.pack(bref));

  if (ext) {
    ext_groups_packer_guard group_flags;
    group_flags[0] |= coreset_r16_present;
    group_flags.pack(bref);

    if (group_flags[0]) {
      varlength_field_pack_guard varlen_scope(bref, false);

      HANDLE_CODE(bref.pack(coreset_r16_present, 1));
      if (coreset_r16_present) {
        HANDLE_CODE(pack_integer(bref, coreset_r16, (uint8_t)0u, (uint8_t)15u));
      }
    }
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE rate_match_pattern_s::unpack(cbit_ref& bref)
{
  bref.unpack(ext, 1);
  HANDLE_CODE(bref.unpack(subcarrier_spacing_present, 1));

  HANDLE_CODE(unpack_integer(rate_match_pattern_id, bref, (uint8_t)0u, (uint8_t)3u));
  HANDLE_CODE(pattern_type.unpack(bref));
  if (subcarrier_spacing_present) {
    HANDLE_CODE(subcarrier_spacing.unpack(bref));
  }
  HANDLE_CODE(dummy.unpack(bref));

  if (ext) {
    ext_groups_unpacker_guard group_flags(1);
    group_flags.unpack(bref);

    if (group_flags[0]) {
      varlength_field_unpack_guard varlen_scope(bref, false);

      HANDLE_CODE(bref.unpack(coreset_r16_present, 1));
      if (coreset_r16_present) {
        HANDLE_CODE(unpack_integer(coreset_r16, bref, (uint8_t)0u, (uint8_t)15u));
      }
    }
  }
  return SRSASN_SUCCESS;
}
void rate_match_pattern_s::to_json(json_writer& j) const
{
  j.start_obj();
  j.write_int("rateMatchPatternId", rate_match_pattern_id);
  j.write_fieldname("patternType");
  pattern_type.to_json(j);
  if (subcarrier_spacing_present) {
    j.write_str("subcarrierSpacing", subcarrier_spacing.to_string());
  }
  j.write_str("dummy", dummy.to_string());
  if (ext) {
    if (coreset_r16_present) {
      j.write_int("controlResourceSet-r16", coreset_r16);
    }
  }
  j.end_obj();
}

void rate_match_pattern_s::pattern_type_c_::destroy_()
{
  switch (type_) {
    case types::bitmaps:
      c.destroy<bitmaps_s_>();
      break;
    default:
      break;
  }
}
void rate_match_pattern_s::pattern_type_c_::set(types::options e)
{
  destroy_();
  type_ = e;
  switch (type_) {
    case types::bitmaps:
      c.init<bitmaps_s_>();
      break;
    case types::coreset:
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "rate_match_pattern_s::pattern_type_c_");
  }
}
rate_match_pattern_s::pattern_type_c_::pattern_type_c_(const rate_match_pattern_s::pattern_type_c_& other)
{
  type_ = other.type();
  switch (type_) {
    case types::bitmaps:
      c.init(other.c.get<bitmaps_s_>());
      break;
    case types::coreset:
      c.init(other.c.get<uint8_t>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "rate_match_pattern_s::pattern_type_c_");
  }
}
rate_match_pattern_s::pattern_type_c_&
rate_match_pattern_s::pattern_type_c_::operator=(const rate_match_pattern_s::pattern_type_c_& other)
{
  if (this == &other) {
    return *this;
  }
  set(other.type());
  switch (type_) {
    case types::bitmaps:
      c.set(other.c.get<bitmaps_s_>());
      break;
    case types::coreset:
      c.set(other.c.get<uint8_t>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "rate_match_pattern_s::pattern_type_c_");
  }

  return *this;
}
rate_match_pattern_s::pattern_type_c_::bitmaps_s_& rate_match_pattern_s::pattern_type_c_::set_bitmaps()
{
  set(types::bitmaps);
  return c.get<bitmaps_s_>();
}
uint8_t& rate_match_pattern_s::pattern_type_c_::set_coreset()
{
  set(types::coreset);
  return c.get<uint8_t>();
}
void rate_match_pattern_s::pattern_type_c_::to_json(json_writer& j) const
{
  j.start_obj();
  switch (type_) {
    case types::bitmaps:
      j.write_fieldname("bitmaps");
      j.start_obj();
      j.write_str("resourceBlocks", c.get<bitmaps_s_>().res_blocks.to_string());
      j.write_fieldname("symbolsInResourceBlock");
      c.get<bitmaps_s_>().symbols_in_res_block.to_json(j);
      if (c.get<bitmaps_s_>().periodicity_and_pattern_present) {
        j.write_fieldname("periodicityAndPattern");
        c.get<bitmaps_s_>().periodicity_and_pattern.to_json(j);
      }
      j.end_obj();
      break;
    case types::coreset:
      j.write_int("controlResourceSet", c.get<uint8_t>());
      break;
    default:
      log_invalid_choice_id(type_, "rate_match_pattern_s::pattern_type_c_");
  }
  j.end_obj();
}
SRSASN_CODE rate_match_pattern_s::pattern_type_c_::pack(bit_ref& bref) const
{
  type_.pack(bref);
  switch (type_) {
    case types::bitmaps:
      bref.pack(c.get<bitmaps_s_>().ext, 1);
      HANDLE_CODE(bref.pack(c.get<bitmaps_s_>().periodicity_and_pattern_present, 1));
      HANDLE_CODE(c.get<bitmaps_s_>().res_blocks.pack(bref));
      HANDLE_CODE(c.get<bitmaps_s_>().symbols_in_res_block.pack(bref));
      if (c.get<bitmaps_s_>().periodicity_and_pattern_present) {
        HANDLE_CODE(c.get<bitmaps_s_>().periodicity_and_pattern.pack(bref));
      }
      break;
    case types::coreset:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)11u));
      break;
    default:
      log_invalid_choice_id(type_, "rate_match_pattern_s::pattern_type_c_");
      return SRSASN_ERROR_ENCODE_FAIL;
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE rate_match_pattern_s::pattern_type_c_::unpack(cbit_ref& bref)
{
  types e;
  e.unpack(bref);
  set(e);
  switch (type_) {
    case types::bitmaps:
      bref.unpack(c.get<bitmaps_s_>().ext, 1);
      HANDLE_CODE(bref.unpack(c.get<bitmaps_s_>().periodicity_and_pattern_present, 1));
      HANDLE_CODE(c.get<bitmaps_s_>().res_blocks.unpack(bref));
      HANDLE_CODE(c.get<bitmaps_s_>().symbols_in_res_block.unpack(bref));
      if (c.get<bitmaps_s_>().periodicity_and_pattern_present) {
        HANDLE_CODE(c.get<bitmaps_s_>().periodicity_and_pattern.unpack(bref));
      }
      break;
    case types::coreset:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)11u));
      break;
    default:
      log_invalid_choice_id(type_, "rate_match_pattern_s::pattern_type_c_");
      return SRSASN_ERROR_DECODE_FAIL;
  }
  return SRSASN_SUCCESS;
}

void rate_match_pattern_s::pattern_type_c_::bitmaps_s_::symbols_in_res_block_c_::destroy_()
{
  switch (type_) {
    case types::one_slot:
      c.destroy<fixed_bitstring<14>>();
      break;
    case types::two_slots:
      c.destroy<fixed_bitstring<28>>();
      break;
    default:
      break;
  }
}
void rate_match_pattern_s::pattern_type_c_::bitmaps_s_::symbols_in_res_block_c_::set(types::options e)
{
  destroy_();
  type_ = e;
  switch (type_) {
    case types::one_slot:
      c.init<fixed_bitstring<14>>();
      break;
    case types::two_slots:
      c.init<fixed_bitstring<28>>();
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "rate_match_pattern_s::pattern_type_c_::bitmaps_s_::symbols_in_res_block_c_");
  }
}
rate_match_pattern_s::pattern_type_c_::bitmaps_s_::symbols_in_res_block_c_::symbols_in_res_block_c_(
    const rate_match_pattern_s::pattern_type_c_::bitmaps_s_::symbols_in_res_block_c_& other)
{
  type_ = other.type();
  switch (type_) {
    case types::one_slot:
      c.init(other.c.get<fixed_bitstring<14>>());
      break;
    case types::two_slots:
      c.init(other.c.get<fixed_bitstring<28>>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "rate_match_pattern_s::pattern_type_c_::bitmaps_s_::symbols_in_res_block_c_");
  }
}
rate_match_pattern_s::pattern_type_c_::bitmaps_s_::symbols_in_res_block_c_&
rate_match_pattern_s::pattern_type_c_::bitmaps_s_::symbols_in_res_block_c_::operator=(
    const rate_match_pattern_s::pattern_type_c_::bitmaps_s_::symbols_in_res_block_c_& other)
{
  if (this == &other) {
    return *this;
  }
  set(other.type());
  switch (type_) {
    case types::one_slot:
      c.set(other.c.get<fixed_bitstring<14>>());
      break;
    case types::two_slots:
      c.set(other.c.get<fixed_bitstring<28>>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "rate_match_pattern_s::pattern_type_c_::bitmaps_s_::symbols_in_res_block_c_");
  }

  return *this;
}
fixed_bitstring<14>& rate_match_pattern_s::pattern_type_c_::bitmaps_s_::symbols_in_res_block_c_::set_one_slot()
{
  set(types::one_slot);
  return c.get<fixed_bitstring<14>>();
}
fixed_bitstring<28>& rate_match_pattern_s::pattern_type_c_::bitmaps_s_::symbols_in_res_block_c_::set_two_slots()
{
  set(types::two_slots);
  return c.get<fixed_bitstring<28>>();
}
void rate_match_pattern_s::pattern_type_c_::bitmaps_s_::symbols_in_res_block_c_::to_json(json_writer& j) const
{
  j.start_obj();
  switch (type_) {
    case types::one_slot:
      j.write_str("oneSlot", c.get<fixed_bitstring<14>>().to_string());
      break;
    case types::two_slots:
      j.write_str("twoSlots", c.get<fixed_bitstring<28>>().to_string());
      break;
    default:
      log_invalid_choice_id(type_, "rate_match_pattern_s::pattern_type_c_::bitmaps_s_::symbols_in_res_block_c_");
  }
  j.end_obj();
}
SRSASN_CODE rate_match_pattern_s::pattern_type_c_::bitmaps_s_::symbols_in_res_block_c_::pack(bit_ref& bref) const
{
  type_.pack(bref);
  switch (type_) {
    case types::one_slot:
      HANDLE_CODE(c.get<fixed_bitstring<14>>().pack(bref));
      break;
    case types::two_slots:
      HANDLE_CODE(c.get<fixed_bitstring<28>>().pack(bref));
      break;
    default:
      log_invalid_choice_id(type_, "rate_match_pattern_s::pattern_type_c_::bitmaps_s_::symbols_in_res_block_c_");
      return SRSASN_ERROR_ENCODE_FAIL;
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE rate_match_pattern_s::pattern_type_c_::bitmaps_s_::symbols_in_res_block_c_::unpack(cbit_ref& bref)
{
  types e;
  e.unpack(bref);
  set(e);
  switch (type_) {
    case types::one_slot:
      HANDLE_CODE(c.get<fixed_bitstring<14>>().unpack(bref));
      break;
    case types::two_slots:
      HANDLE_CODE(c.get<fixed_bitstring<28>>().unpack(bref));
      break;
    default:
      log_invalid_choice_id(type_, "rate_match_pattern_s::pattern_type_c_::bitmaps_s_::symbols_in_res_block_c_");
      return SRSASN_ERROR_DECODE_FAIL;
  }
  return SRSASN_SUCCESS;
}

const char* rate_match_pattern_s::pattern_type_c_::bitmaps_s_::symbols_in_res_block_c_::types_opts::to_string() const
{
  static const char* names[] = {"oneSlot", "twoSlots"};
  return convert_enum_idx(
      names, 2, value, "rate_match_pattern_s::pattern_type_c_::bitmaps_s_::symbols_in_res_block_c_::types");
}
uint8_t rate_match_pattern_s::pattern_type_c_::bitmaps_s_::symbols_in_res_block_c_::types_opts::to_number() const
{
  static const uint8_t numbers[] = {1, 2};
  return map_enum_number(
      numbers, 2, value, "rate_match_pattern_s::pattern_type_c_::bitmaps_s_::symbols_in_res_block_c_::types");
}

void rate_match_pattern_s::pattern_type_c_::bitmaps_s_::periodicity_and_pattern_c_::destroy_()
{
  switch (type_) {
    case types::n2:
      c.destroy<fixed_bitstring<2>>();
      break;
    case types::n4:
      c.destroy<fixed_bitstring<4>>();
      break;
    case types::n5:
      c.destroy<fixed_bitstring<5>>();
      break;
    case types::n8:
      c.destroy<fixed_bitstring<8>>();
      break;
    case types::n10:
      c.destroy<fixed_bitstring<10>>();
      break;
    case types::n20:
      c.destroy<fixed_bitstring<20>>();
      break;
    case types::n40:
      c.destroy<fixed_bitstring<40>>();
      break;
    default:
      break;
  }
}
void rate_match_pattern_s::pattern_type_c_::bitmaps_s_::periodicity_and_pattern_c_::set(types::options e)
{
  destroy_();
  type_ = e;
  switch (type_) {
    case types::n2:
      c.init<fixed_bitstring<2>>();
      break;
    case types::n4:
      c.init<fixed_bitstring<4>>();
      break;
    case types::n5:
      c.init<fixed_bitstring<5>>();
      break;
    case types::n8:
      c.init<fixed_bitstring<8>>();
      break;
    case types::n10:
      c.init<fixed_bitstring<10>>();
      break;
    case types::n20:
      c.init<fixed_bitstring<20>>();
      break;
    case types::n40:
      c.init<fixed_bitstring<40>>();
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "rate_match_pattern_s::pattern_type_c_::bitmaps_s_::periodicity_and_pattern_c_");
  }
}
rate_match_pattern_s::pattern_type_c_::bitmaps_s_::periodicity_and_pattern_c_::periodicity_and_pattern_c_(
    const rate_match_pattern_s::pattern_type_c_::bitmaps_s_::periodicity_and_pattern_c_& other)
{
  type_ = other.type();
  switch (type_) {
    case types::n2:
      c.init(other.c.get<fixed_bitstring<2>>());
      break;
    case types::n4:
      c.init(other.c.get<fixed_bitstring<4>>());
      break;
    case types::n5:
      c.init(other.c.get<fixed_bitstring<5>>());
      break;
    case types::n8:
      c.init(other.c.get<fixed_bitstring<8>>());
      break;
    case types::n10:
      c.init(other.c.get<fixed_bitstring<10>>());
      break;
    case types::n20:
      c.init(other.c.get<fixed_bitstring<20>>());
      break;
    case types::n40:
      c.init(other.c.get<fixed_bitstring<40>>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "rate_match_pattern_s::pattern_type_c_::bitmaps_s_::periodicity_and_pattern_c_");
  }
}
rate_match_pattern_s::pattern_type_c_::bitmaps_s_::periodicity_and_pattern_c_&
rate_match_pattern_s::pattern_type_c_::bitmaps_s_::periodicity_and_pattern_c_::operator=(
    const rate_match_pattern_s::pattern_type_c_::bitmaps_s_::periodicity_and_pattern_c_& other)
{
  if (this == &other) {
    return *this;
  }
  set(other.type());
  switch (type_) {
    case types::n2:
      c.set(other.c.get<fixed_bitstring<2>>());
      break;
    case types::n4:
      c.set(other.c.get<fixed_bitstring<4>>());
      break;
    case types::n5:
      c.set(other.c.get<fixed_bitstring<5>>());
      break;
    case types::n8:
      c.set(other.c.get<fixed_bitstring<8>>());
      break;
    case types::n10:
      c.set(other.c.get<fixed_bitstring<10>>());
      break;
    case types::n20:
      c.set(other.c.get<fixed_bitstring<20>>());
      break;
    case types::n40:
      c.set(other.c.get<fixed_bitstring<40>>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "rate_match_pattern_s::pattern_type_c_::bitmaps_s_::periodicity_and_pattern_c_");
  }

  return *this;
}
fixed_bitstring<2>& rate_match_pattern_s::pattern_type_c_::bitmaps_s_::periodicity_and_pattern_c_::set_n2()
{
  set(types::n2);
  return c.get<fixed_bitstring<2>>();
}
fixed_bitstring<4>& rate_match_pattern_s::pattern_type_c_::bitmaps_s_::periodicity_and_pattern_c_::set_n4()
{
  set(types::n4);
  return c.get<fixed_bitstring<4>>();
}
fixed_bitstring<5>& rate_match_pattern_s::pattern_type_c_::bitmaps_s_::periodicity_and_pattern_c_::set_n5()
{
  set(types::n5);
  return c.get<fixed_bitstring<5>>();
}
fixed_bitstring<8>& rate_match_pattern_s::pattern_type_c_::bitmaps_s_::periodicity_and_pattern_c_::set_n8()
{
  set(types::n8);
  return c.get<fixed_bitstring<8>>();
}
fixed_bitstring<10>& rate_match_pattern_s::pattern_type_c_::bitmaps_s_::periodicity_and_pattern_c_::set_n10()
{
  set(types::n10);
  return c.get<fixed_bitstring<10>>();
}
fixed_bitstring<20>& rate_match_pattern_s::pattern_type_c_::bitmaps_s_::periodicity_and_pattern_c_::set_n20()
{
  set(types::n20);
  return c.get<fixed_bitstring<20>>();
}
fixed_bitstring<40>& rate_match_pattern_s::pattern_type_c_::bitmaps_s_::periodicity_and_pattern_c_::set_n40()
{
  set(types::n40);
  return c.get<fixed_bitstring<40>>();
}
void rate_match_pattern_s::pattern_type_c_::bitmaps_s_::periodicity_and_pattern_c_::to_json(json_writer& j) const
{
  j.start_obj();
  switch (type_) {
    case types::n2:
      j.write_str("n2", c.get<fixed_bitstring<2>>().to_string());
      break;
    case types::n4:
      j.write_str("n4", c.get<fixed_bitstring<4>>().to_string());
      break;
    case types::n5:
      j.write_str("n5", c.get<fixed_bitstring<5>>().to_string());
      break;
    case types::n8:
      j.write_str("n8", c.get<fixed_bitstring<8>>().to_string());
      break;
    case types::n10:
      j.write_str("n10", c.get<fixed_bitstring<10>>().to_string());
      break;
    case types::n20:
      j.write_str("n20", c.get<fixed_bitstring<20>>().to_string());
      break;
    case types::n40:
      j.write_str("n40", c.get<fixed_bitstring<40>>().to_string());
      break;
    default:
      log_invalid_choice_id(type_, "rate_match_pattern_s::pattern_type_c_::bitmaps_s_::periodicity_and_pattern_c_");
  }
  j.end_obj();
}
SRSASN_CODE rate_match_pattern_s::pattern_type_c_::bitmaps_s_::periodicity_and_pattern_c_::pack(bit_ref& bref) const
{
  type_.pack(bref);
  switch (type_) {
    case types::n2:
      HANDLE_CODE(c.get<fixed_bitstring<2>>().pack(bref));
      break;
    case types::n4:
      HANDLE_CODE(c.get<fixed_bitstring<4>>().pack(bref));
      break;
    case types::n5:
      HANDLE_CODE(c.get<fixed_bitstring<5>>().pack(bref));
      break;
    case types::n8:
      HANDLE_CODE(c.get<fixed_bitstring<8>>().pack(bref));
      break;
    case types::n10:
      HANDLE_CODE(c.get<fixed_bitstring<10>>().pack(bref));
      break;
    case types::n20:
      HANDLE_CODE(c.get<fixed_bitstring<20>>().pack(bref));
      break;
    case types::n40:
      HANDLE_CODE(c.get<fixed_bitstring<40>>().pack(bref));
      break;
    default:
      log_invalid_choice_id(type_, "rate_match_pattern_s::pattern_type_c_::bitmaps_s_::periodicity_and_pattern_c_");
      return SRSASN_ERROR_ENCODE_FAIL;
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE rate_match_pattern_s::pattern_type_c_::bitmaps_s_::periodicity_and_pattern_c_::unpack(cbit_ref& bref)
{
  types e;
  e.unpack(bref);
  set(e);
  switch (type_) {
    case types::n2:
      HANDLE_CODE(c.get<fixed_bitstring<2>>().unpack(bref));
      break;
    case types::n4:
      HANDLE_CODE(c.get<fixed_bitstring<4>>().unpack(bref));
      break;
    case types::n5:
      HANDLE_CODE(c.get<fixed_bitstring<5>>().unpack(bref));
      break;
    case types::n8:
      HANDLE_CODE(c.get<fixed_bitstring<8>>().unpack(bref));
      break;
    case types::n10:
      HANDLE_CODE(c.get<fixed_bitstring<10>>().unpack(bref));
      break;
    case types::n20:
      HANDLE_CODE(c.get<fixed_bitstring<20>>().unpack(bref));
      break;
    case types::n40:
      HANDLE_CODE(c.get<fixed_bitstring<40>>().unpack(bref));
      break;
    default:
      log_invalid_choice_id(type_, "rate_match_pattern_s::pattern_type_c_::bitmaps_s_::periodicity_and_pattern_c_");
      return SRSASN_ERROR_DECODE_FAIL;
  }
  return SRSASN_SUCCESS;
}

const char* rate_match_pattern_s::pattern_type_c_::bitmaps_s_::periodicity_and_pattern_c_::types_opts::to_string() const
{
  static const char* names[] = {"n2", "n4", "n5", "n8", "n10", "n20", "n40"};
  return convert_enum_idx(
      names, 7, value, "rate_match_pattern_s::pattern_type_c_::bitmaps_s_::periodicity_and_pattern_c_::types");
}
uint8_t rate_match_pattern_s::pattern_type_c_::bitmaps_s_::periodicity_and_pattern_c_::types_opts::to_number() const
{
  static const uint8_t numbers[] = {2, 4, 5, 8, 10, 20, 40};
  return map_enum_number(
      numbers, 7, value, "rate_match_pattern_s::pattern_type_c_::bitmaps_s_::periodicity_and_pattern_c_::types");
}

const char* rate_match_pattern_s::pattern_type_c_::types_opts::to_string() const
{
  static const char* names[] = {"bitmaps", "controlResourceSet"};
  return convert_enum_idx(names, 2, value, "rate_match_pattern_s::pattern_type_c_::types");
}

const char* rate_match_pattern_s::dummy_opts::to_string() const
{
  static const char* names[] = {"dynamic", "semiStatic"};
  return convert_enum_idx(names, 2, value, "rate_match_pattern_s::dummy_e_");
}

// SearchSpace ::= SEQUENCE
SRSASN_CODE search_space_s::pack(bit_ref& bref) const
{
  HANDLE_CODE(bref.pack(coreset_id_present, 1));
  HANDLE_CODE(bref.pack(monitoring_slot_periodicity_and_offset_present, 1));
  HANDLE_CODE(bref.pack(dur_present, 1));
  HANDLE_CODE(bref.pack(monitoring_symbols_within_slot_present, 1));
  HANDLE_CODE(bref.pack(nrof_candidates_present, 1));
  HANDLE_CODE(bref.pack(search_space_type_present, 1));

  HANDLE_CODE(pack_integer(bref, search_space_id, (uint8_t)0u, (uint8_t)39u));
  if (coreset_id_present) {
    HANDLE_CODE(pack_integer(bref, coreset_id, (uint8_t)0u, (uint8_t)11u));
  }
  if (monitoring_slot_periodicity_and_offset_present) {
    HANDLE_CODE(monitoring_slot_periodicity_and_offset.pack(bref));
  }
  if (dur_present) {
    HANDLE_CODE(pack_integer(bref, dur, (uint16_t)2u, (uint16_t)2559u));
  }
  if (monitoring_symbols_within_slot_present) {
    HANDLE_CODE(monitoring_symbols_within_slot.pack(bref));
  }
  if (nrof_candidates_present) {
    HANDLE_CODE(nrof_candidates.aggregation_level1.pack(bref));
    HANDLE_CODE(nrof_candidates.aggregation_level2.pack(bref));
    HANDLE_CODE(nrof_candidates.aggregation_level4.pack(bref));
    HANDLE_CODE(nrof_candidates.aggregation_level8.pack(bref));
    HANDLE_CODE(nrof_candidates.aggregation_level16.pack(bref));
  }
  if (search_space_type_present) {
    HANDLE_CODE(search_space_type.pack(bref));
  }

  return SRSASN_SUCCESS;
}
SRSASN_CODE search_space_s::unpack(cbit_ref& bref)
{
  HANDLE_CODE(bref.unpack(coreset_id_present, 1));
  HANDLE_CODE(bref.unpack(monitoring_slot_periodicity_and_offset_present, 1));
  HANDLE_CODE(bref.unpack(dur_present, 1));
  HANDLE_CODE(bref.unpack(monitoring_symbols_within_slot_present, 1));
  HANDLE_CODE(bref.unpack(nrof_candidates_present, 1));
  HANDLE_CODE(bref.unpack(search_space_type_present, 1));

  HANDLE_CODE(unpack_integer(search_space_id, bref, (uint8_t)0u, (uint8_t)39u));
  if (coreset_id_present) {
    HANDLE_CODE(unpack_integer(coreset_id, bref, (uint8_t)0u, (uint8_t)11u));
  }
  if (monitoring_slot_periodicity_and_offset_present) {
    HANDLE_CODE(monitoring_slot_periodicity_and_offset.unpack(bref));
  }
  if (dur_present) {
    HANDLE_CODE(unpack_integer(dur, bref, (uint16_t)2u, (uint16_t)2559u));
  }
  if (monitoring_symbols_within_slot_present) {
    HANDLE_CODE(monitoring_symbols_within_slot.unpack(bref));
  }
  if (nrof_candidates_present) {
    HANDLE_CODE(nrof_candidates.aggregation_level1.unpack(bref));
    HANDLE_CODE(nrof_candidates.aggregation_level2.unpack(bref));
    HANDLE_CODE(nrof_candidates.aggregation_level4.unpack(bref));
    HANDLE_CODE(nrof_candidates.aggregation_level8.unpack(bref));
    HANDLE_CODE(nrof_candidates.aggregation_level16.unpack(bref));
  }
  if (search_space_type_present) {
    HANDLE_CODE(search_space_type.unpack(bref));
  }

  return SRSASN_SUCCESS;
}
void search_space_s::to_json(json_writer& j) const
{
  j.start_obj();
  j.write_int("searchSpaceId", search_space_id);
  if (coreset_id_present) {
    j.write_int("controlResourceSetId", coreset_id);
  }
  if (monitoring_slot_periodicity_and_offset_present) {
    j.write_fieldname("monitoringSlotPeriodicityAndOffset");
    monitoring_slot_periodicity_and_offset.to_json(j);
  }
  if (dur_present) {
    j.write_int("duration", dur);
  }
  if (monitoring_symbols_within_slot_present) {
    j.write_str("monitoringSymbolsWithinSlot", monitoring_symbols_within_slot.to_string());
  }
  if (nrof_candidates_present) {
    j.write_fieldname("nrofCandidates");
    j.start_obj();
    j.write_str("aggregationLevel1", nrof_candidates.aggregation_level1.to_string());
    j.write_str("aggregationLevel2", nrof_candidates.aggregation_level2.to_string());
    j.write_str("aggregationLevel4", nrof_candidates.aggregation_level4.to_string());
    j.write_str("aggregationLevel8", nrof_candidates.aggregation_level8.to_string());
    j.write_str("aggregationLevel16", nrof_candidates.aggregation_level16.to_string());
    j.end_obj();
  }
  if (search_space_type_present) {
    j.write_fieldname("searchSpaceType");
    search_space_type.to_json(j);
  }
  j.end_obj();
}

void search_space_s::monitoring_slot_periodicity_and_offset_c_::destroy_() {}
void search_space_s::monitoring_slot_periodicity_and_offset_c_::set(types::options e)
{
  destroy_();
  type_ = e;
}
search_space_s::monitoring_slot_periodicity_and_offset_c_::monitoring_slot_periodicity_and_offset_c_(
    const search_space_s::monitoring_slot_periodicity_and_offset_c_& other)
{
  type_ = other.type();
  switch (type_) {
    case types::sl1:
      break;
    case types::sl2:
      c.init(other.c.get<uint8_t>());
      break;
    case types::sl4:
      c.init(other.c.get<uint8_t>());
      break;
    case types::sl5:
      c.init(other.c.get<uint8_t>());
      break;
    case types::sl8:
      c.init(other.c.get<uint8_t>());
      break;
    case types::sl10:
      c.init(other.c.get<uint8_t>());
      break;
    case types::sl16:
      c.init(other.c.get<uint8_t>());
      break;
    case types::sl20:
      c.init(other.c.get<uint8_t>());
      break;
    case types::sl40:
      c.init(other.c.get<uint8_t>());
      break;
    case types::sl80:
      c.init(other.c.get<uint8_t>());
      break;
    case types::sl160:
      c.init(other.c.get<uint8_t>());
      break;
    case types::sl320:
      c.init(other.c.get<uint16_t>());
      break;
    case types::sl640:
      c.init(other.c.get<uint16_t>());
      break;
    case types::sl1280:
      c.init(other.c.get<uint16_t>());
      break;
    case types::sl2560:
      c.init(other.c.get<uint16_t>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "search_space_s::monitoring_slot_periodicity_and_offset_c_");
  }
}
search_space_s::monitoring_slot_periodicity_and_offset_c_&
search_space_s::monitoring_slot_periodicity_and_offset_c_::operator=(
    const search_space_s::monitoring_slot_periodicity_and_offset_c_& other)
{
  if (this == &other) {
    return *this;
  }
  set(other.type());
  switch (type_) {
    case types::sl1:
      break;
    case types::sl2:
      c.set(other.c.get<uint8_t>());
      break;
    case types::sl4:
      c.set(other.c.get<uint8_t>());
      break;
    case types::sl5:
      c.set(other.c.get<uint8_t>());
      break;
    case types::sl8:
      c.set(other.c.get<uint8_t>());
      break;
    case types::sl10:
      c.set(other.c.get<uint8_t>());
      break;
    case types::sl16:
      c.set(other.c.get<uint8_t>());
      break;
    case types::sl20:
      c.set(other.c.get<uint8_t>());
      break;
    case types::sl40:
      c.set(other.c.get<uint8_t>());
      break;
    case types::sl80:
      c.set(other.c.get<uint8_t>());
      break;
    case types::sl160:
      c.set(other.c.get<uint8_t>());
      break;
    case types::sl320:
      c.set(other.c.get<uint16_t>());
      break;
    case types::sl640:
      c.set(other.c.get<uint16_t>());
      break;
    case types::sl1280:
      c.set(other.c.get<uint16_t>());
      break;
    case types::sl2560:
      c.set(other.c.get<uint16_t>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "search_space_s::monitoring_slot_periodicity_and_offset_c_");
  }

  return *this;
}
void search_space_s::monitoring_slot_periodicity_and_offset_c_::set_sl1()
{
  set(types::sl1);
}
uint8_t& search_space_s::monitoring_slot_periodicity_and_offset_c_::set_sl2()
{
  set(types::sl2);
  return c.get<uint8_t>();
}
uint8_t& search_space_s::monitoring_slot_periodicity_and_offset_c_::set_sl4()
{
  set(types::sl4);
  return c.get<uint8_t>();
}
uint8_t& search_space_s::monitoring_slot_periodicity_and_offset_c_::set_sl5()
{
  set(types::sl5);
  return c.get<uint8_t>();
}
uint8_t& search_space_s::monitoring_slot_periodicity_and_offset_c_::set_sl8()
{
  set(types::sl8);
  return c.get<uint8_t>();
}
uint8_t& search_space_s::monitoring_slot_periodicity_and_offset_c_::set_sl10()
{
  set(types::sl10);
  return c.get<uint8_t>();
}
uint8_t& search_space_s::monitoring_slot_periodicity_and_offset_c_::set_sl16()
{
  set(types::sl16);
  return c.get<uint8_t>();
}
uint8_t& search_space_s::monitoring_slot_periodicity_and_offset_c_::set_sl20()
{
  set(types::sl20);
  return c.get<uint8_t>();
}
uint8_t& search_space_s::monitoring_slot_periodicity_and_offset_c_::set_sl40()
{
  set(types::sl40);
  return c.get<uint8_t>();
}
uint8_t& search_space_s::monitoring_slot_periodicity_and_offset_c_::set_sl80()
{
  set(types::sl80);
  return c.get<uint8_t>();
}
uint8_t& search_space_s::monitoring_slot_periodicity_and_offset_c_::set_sl160()
{
  set(types::sl160);
  return c.get<uint8_t>();
}
uint16_t& search_space_s::monitoring_slot_periodicity_and_offset_c_::set_sl320()
{
  set(types::sl320);
  return c.get<uint16_t>();
}
uint16_t& search_space_s::monitoring_slot_periodicity_and_offset_c_::set_sl640()
{
  set(types::sl640);
  return c.get<uint16_t>();
}
uint16_t& search_space_s::monitoring_slot_periodicity_and_offset_c_::set_sl1280()
{
  set(types::sl1280);
  return c.get<uint16_t>();
}
uint16_t& search_space_s::monitoring_slot_periodicity_and_offset_c_::set_sl2560()
{
  set(types::sl2560);
  return c.get<uint16_t>();
}
void search_space_s::monitoring_slot_periodicity_and_offset_c_::to_json(json_writer& j) const
{
  j.start_obj();
  switch (type_) {
    case types::sl1:
      break;
    case types::sl2:
      j.write_int("sl2", c.get<uint8_t>());
      break;
    case types::sl4:
      j.write_int("sl4", c.get<uint8_t>());
      break;
    case types::sl5:
      j.write_int("sl5", c.get<uint8_t>());
      break;
    case types::sl8:
      j.write_int("sl8", c.get<uint8_t>());
      break;
    case types::sl10:
      j.write_int("sl10", c.get<uint8_t>());
      break;
    case types::sl16:
      j.write_int("sl16", c.get<uint8_t>());
      break;
    case types::sl20:
      j.write_int("sl20", c.get<uint8_t>());
      break;
    case types::sl40:
      j.write_int("sl40", c.get<uint8_t>());
      break;
    case types::sl80:
      j.write_int("sl80", c.get<uint8_t>());
      break;
    case types::sl160:
      j.write_int("sl160", c.get<uint8_t>());
      break;
    case types::sl320:
      j.write_int("sl320", c.get<uint16_t>());
      break;
    case types::sl640:
      j.write_int("sl640", c.get<uint16_t>());
      break;
    case types::sl1280:
      j.write_int("sl1280", c.get<uint16_t>());
      break;
    case types::sl2560:
      j.write_int("sl2560", c.get<uint16_t>());
      break;
    default:
      log_invalid_choice_id(type_, "search_space_s::monitoring_slot_periodicity_and_offset_c_");
  }
  j.end_obj();
}
SRSASN_CODE search_space_s::monitoring_slot_periodicity_and_offset_c_::pack(bit_ref& bref) const
{
  type_.pack(bref);
  switch (type_) {
    case types::sl1:
      break;
    case types::sl2:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)1u));
      break;
    case types::sl4:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)3u));
      break;
    case types::sl5:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)4u));
      break;
    case types::sl8:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)7u));
      break;
    case types::sl10:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)9u));
      break;
    case types::sl16:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)15u));
      break;
    case types::sl20:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)19u));
      break;
    case types::sl40:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)39u));
      break;
    case types::sl80:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)79u));
      break;
    case types::sl160:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)159u));
      break;
    case types::sl320:
      HANDLE_CODE(pack_integer(bref, c.get<uint16_t>(), (uint16_t)0u, (uint16_t)319u));
      break;
    case types::sl640:
      HANDLE_CODE(pack_integer(bref, c.get<uint16_t>(), (uint16_t)0u, (uint16_t)639u));
      break;
    case types::sl1280:
      HANDLE_CODE(pack_integer(bref, c.get<uint16_t>(), (uint16_t)0u, (uint16_t)1279u));
      break;
    case types::sl2560:
      HANDLE_CODE(pack_integer(bref, c.get<uint16_t>(), (uint16_t)0u, (uint16_t)2559u));
      break;
    default:
      log_invalid_choice_id(type_, "search_space_s::monitoring_slot_periodicity_and_offset_c_");
      return SRSASN_ERROR_ENCODE_FAIL;
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE search_space_s::monitoring_slot_periodicity_and_offset_c_::unpack(cbit_ref& bref)
{
  types e;
  e.unpack(bref);
  set(e);
  switch (type_) {
    case types::sl1:
      break;
    case types::sl2:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)1u));
      break;
    case types::sl4:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)3u));
      break;
    case types::sl5:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)4u));
      break;
    case types::sl8:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)7u));
      break;
    case types::sl10:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)9u));
      break;
    case types::sl16:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)15u));
      break;
    case types::sl20:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)19u));
      break;
    case types::sl40:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)39u));
      break;
    case types::sl80:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)79u));
      break;
    case types::sl160:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)159u));
      break;
    case types::sl320:
      HANDLE_CODE(unpack_integer(c.get<uint16_t>(), bref, (uint16_t)0u, (uint16_t)319u));
      break;
    case types::sl640:
      HANDLE_CODE(unpack_integer(c.get<uint16_t>(), bref, (uint16_t)0u, (uint16_t)639u));
      break;
    case types::sl1280:
      HANDLE_CODE(unpack_integer(c.get<uint16_t>(), bref, (uint16_t)0u, (uint16_t)1279u));
      break;
    case types::sl2560:
      HANDLE_CODE(unpack_integer(c.get<uint16_t>(), bref, (uint16_t)0u, (uint16_t)2559u));
      break;
    default:
      log_invalid_choice_id(type_, "search_space_s::monitoring_slot_periodicity_and_offset_c_");
      return SRSASN_ERROR_DECODE_FAIL;
  }
  return SRSASN_SUCCESS;
}

const char* search_space_s::monitoring_slot_periodicity_and_offset_c_::types_opts::to_string() const
{
  static const char* names[] = {"sl1",
                                "sl2",
                                "sl4",
                                "sl5",
                                "sl8",
                                "sl10",
                                "sl16",
                                "sl20",
                                "sl40",
                                "sl80",
                                "sl160",
                                "sl320",
                                "sl640",
                                "sl1280",
                                "sl2560"};
  return convert_enum_idx(names, 15, value, "search_space_s::monitoring_slot_periodicity_and_offset_c_::types");
}
uint16_t search_space_s::monitoring_slot_periodicity_and_offset_c_::types_opts::to_number() const
{
  static const uint16_t numbers[] = {1, 2, 4, 5, 8, 10, 16, 20, 40, 80, 160, 320, 640, 1280, 2560};
  return map_enum_number(numbers, 15, value, "search_space_s::monitoring_slot_periodicity_and_offset_c_::types");
}

const char* search_space_s::nrof_candidates_s_::aggregation_level1_opts::to_string() const
{
  static const char* names[] = {"n0", "n1", "n2", "n3", "n4", "n5", "n6", "n8"};
  return convert_enum_idx(names, 8, value, "search_space_s::nrof_candidates_s_::aggregation_level1_e_");
}
uint8_t search_space_s::nrof_candidates_s_::aggregation_level1_opts::to_number() const
{
  static const uint8_t numbers[] = {0, 1, 2, 3, 4, 5, 6, 8};
  return map_enum_number(numbers, 8, value, "search_space_s::nrof_candidates_s_::aggregation_level1_e_");
}

const char* search_space_s::nrof_candidates_s_::aggregation_level2_opts::to_string() const
{
  static const char* names[] = {"n0", "n1", "n2", "n3", "n4", "n5", "n6", "n8"};
  return convert_enum_idx(names, 8, value, "search_space_s::nrof_candidates_s_::aggregation_level2_e_");
}
uint8_t search_space_s::nrof_candidates_s_::aggregation_level2_opts::to_number() const
{
  static const uint8_t numbers[] = {0, 1, 2, 3, 4, 5, 6, 8};
  return map_enum_number(numbers, 8, value, "search_space_s::nrof_candidates_s_::aggregation_level2_e_");
}

const char* search_space_s::nrof_candidates_s_::aggregation_level4_opts::to_string() const
{
  static const char* names[] = {"n0", "n1", "n2", "n3", "n4", "n5", "n6", "n8"};
  return convert_enum_idx(names, 8, value, "search_space_s::nrof_candidates_s_::aggregation_level4_e_");
}
uint8_t search_space_s::nrof_candidates_s_::aggregation_level4_opts::to_number() const
{
  static const uint8_t numbers[] = {0, 1, 2, 3, 4, 5, 6, 8};
  return map_enum_number(numbers, 8, value, "search_space_s::nrof_candidates_s_::aggregation_level4_e_");
}

const char* search_space_s::nrof_candidates_s_::aggregation_level8_opts::to_string() const
{
  static const char* names[] = {"n0", "n1", "n2", "n3", "n4", "n5", "n6", "n8"};
  return convert_enum_idx(names, 8, value, "search_space_s::nrof_candidates_s_::aggregation_level8_e_");
}
uint8_t search_space_s::nrof_candidates_s_::aggregation_level8_opts::to_number() const
{
  static const uint8_t numbers[] = {0, 1, 2, 3, 4, 5, 6, 8};
  return map_enum_number(numbers, 8, value, "search_space_s::nrof_candidates_s_::aggregation_level8_e_");
}

const char* search_space_s::nrof_candidates_s_::aggregation_level16_opts::to_string() const
{
  static const char* names[] = {"n0", "n1", "n2", "n3", "n4", "n5", "n6", "n8"};
  return convert_enum_idx(names, 8, value, "search_space_s::nrof_candidates_s_::aggregation_level16_e_");
}
uint8_t search_space_s::nrof_candidates_s_::aggregation_level16_opts::to_number() const
{
  static const uint8_t numbers[] = {0, 1, 2, 3, 4, 5, 6, 8};
  return map_enum_number(numbers, 8, value, "search_space_s::nrof_candidates_s_::aggregation_level16_e_");
}

void search_space_s::search_space_type_c_::destroy_()
{
  switch (type_) {
    case types::common:
      c.destroy<common_s_>();
      break;
    case types::ue_specific:
      c.destroy<ue_specific_s_>();
      break;
    default:
      break;
  }
}
void search_space_s::search_space_type_c_::set(types::options e)
{
  destroy_();
  type_ = e;
  switch (type_) {
    case types::common:
      c.init<common_s_>();
      break;
    case types::ue_specific:
      c.init<ue_specific_s_>();
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "search_space_s::search_space_type_c_");
  }
}
search_space_s::search_space_type_c_::search_space_type_c_(const search_space_s::search_space_type_c_& other)
{
  type_ = other.type();
  switch (type_) {
    case types::common:
      c.init(other.c.get<common_s_>());
      break;
    case types::ue_specific:
      c.init(other.c.get<ue_specific_s_>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "search_space_s::search_space_type_c_");
  }
}
search_space_s::search_space_type_c_&
search_space_s::search_space_type_c_::operator=(const search_space_s::search_space_type_c_& other)
{
  if (this == &other) {
    return *this;
  }
  set(other.type());
  switch (type_) {
    case types::common:
      c.set(other.c.get<common_s_>());
      break;
    case types::ue_specific:
      c.set(other.c.get<ue_specific_s_>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "search_space_s::search_space_type_c_");
  }

  return *this;
}
search_space_s::search_space_type_c_::common_s_& search_space_s::search_space_type_c_::set_common()
{
  set(types::common);
  return c.get<common_s_>();
}
search_space_s::search_space_type_c_::ue_specific_s_& search_space_s::search_space_type_c_::set_ue_specific()
{
  set(types::ue_specific);
  return c.get<ue_specific_s_>();
}
void search_space_s::search_space_type_c_::to_json(json_writer& j) const
{
  j.start_obj();
  switch (type_) {
    case types::common:
      j.write_fieldname("common");
      j.start_obj();
      if (c.get<common_s_>().dci_format0_0_and_format1_0_present) {
        j.write_fieldname("dci-Format0-0-AndFormat1-0");
        j.start_obj();
        j.end_obj();
      }
      if (c.get<common_s_>().dci_format2_0_present) {
        j.write_fieldname("dci-Format2-0");
        j.start_obj();
        j.write_fieldname("nrofCandidates-SFI");
        j.start_obj();
        if (c.get<common_s_>().dci_format2_0.nrof_candidates_sfi.aggregation_level1_present) {
          j.write_str("aggregationLevel1",
                      c.get<common_s_>().dci_format2_0.nrof_candidates_sfi.aggregation_level1.to_string());
        }
        if (c.get<common_s_>().dci_format2_0.nrof_candidates_sfi.aggregation_level2_present) {
          j.write_str("aggregationLevel2",
                      c.get<common_s_>().dci_format2_0.nrof_candidates_sfi.aggregation_level2.to_string());
        }
        if (c.get<common_s_>().dci_format2_0.nrof_candidates_sfi.aggregation_level4_present) {
          j.write_str("aggregationLevel4",
                      c.get<common_s_>().dci_format2_0.nrof_candidates_sfi.aggregation_level4.to_string());
        }
        if (c.get<common_s_>().dci_format2_0.nrof_candidates_sfi.aggregation_level8_present) {
          j.write_str("aggregationLevel8",
                      c.get<common_s_>().dci_format2_0.nrof_candidates_sfi.aggregation_level8.to_string());
        }
        if (c.get<common_s_>().dci_format2_0.nrof_candidates_sfi.aggregation_level16_present) {
          j.write_str("aggregationLevel16",
                      c.get<common_s_>().dci_format2_0.nrof_candidates_sfi.aggregation_level16.to_string());
        }
        j.end_obj();
        j.end_obj();
      }
      if (c.get<common_s_>().dci_format2_1_present) {
        j.write_fieldname("dci-Format2-1");
        j.start_obj();
        j.end_obj();
      }
      if (c.get<common_s_>().dci_format2_2_present) {
        j.write_fieldname("dci-Format2-2");
        j.start_obj();
        j.end_obj();
      }
      if (c.get<common_s_>().dci_format2_3_present) {
        j.write_fieldname("dci-Format2-3");
        j.start_obj();
        if (c.get<common_s_>().dci_format2_3.dummy1_present) {
          j.write_str("dummy1", c.get<common_s_>().dci_format2_3.dummy1.to_string());
        }
        j.write_str("dummy2", c.get<common_s_>().dci_format2_3.dummy2.to_string());
        j.end_obj();
      }
      j.end_obj();
      break;
    case types::ue_specific:
      j.write_fieldname("ue-Specific");
      c.get<ue_specific_s_>().to_json(j);
      break;
    default:
      log_invalid_choice_id(type_, "search_space_s::search_space_type_c_");
  }
  j.end_obj();
}
SRSASN_CODE search_space_s::search_space_type_c_::pack(bit_ref& bref) const
{
  type_.pack(bref);
  switch (type_) {
    case types::common:
      HANDLE_CODE(bref.pack(c.get<common_s_>().dci_format0_0_and_format1_0_present, 1));
      HANDLE_CODE(bref.pack(c.get<common_s_>().dci_format2_0_present, 1));
      HANDLE_CODE(bref.pack(c.get<common_s_>().dci_format2_1_present, 1));
      HANDLE_CODE(bref.pack(c.get<common_s_>().dci_format2_2_present, 1));
      HANDLE_CODE(bref.pack(c.get<common_s_>().dci_format2_3_present, 1));
      if (c.get<common_s_>().dci_format0_0_and_format1_0_present) {
        bref.pack(c.get<common_s_>().dci_format0_0_and_format1_0.ext, 1);
      }
      if (c.get<common_s_>().dci_format2_0_present) {
        bref.pack(c.get<common_s_>().dci_format2_0.ext, 1);
        HANDLE_CODE(bref.pack(c.get<common_s_>().dci_format2_0.nrof_candidates_sfi.aggregation_level1_present, 1));
        HANDLE_CODE(bref.pack(c.get<common_s_>().dci_format2_0.nrof_candidates_sfi.aggregation_level2_present, 1));
        HANDLE_CODE(bref.pack(c.get<common_s_>().dci_format2_0.nrof_candidates_sfi.aggregation_level4_present, 1));
        HANDLE_CODE(bref.pack(c.get<common_s_>().dci_format2_0.nrof_candidates_sfi.aggregation_level8_present, 1));
        HANDLE_CODE(bref.pack(c.get<common_s_>().dci_format2_0.nrof_candidates_sfi.aggregation_level16_present, 1));
        if (c.get<common_s_>().dci_format2_0.nrof_candidates_sfi.aggregation_level1_present) {
          HANDLE_CODE(c.get<common_s_>().dci_format2_0.nrof_candidates_sfi.aggregation_level1.pack(bref));
        }
        if (c.get<common_s_>().dci_format2_0.nrof_candidates_sfi.aggregation_level2_present) {
          HANDLE_CODE(c.get<common_s_>().dci_format2_0.nrof_candidates_sfi.aggregation_level2.pack(bref));
        }
        if (c.get<common_s_>().dci_format2_0.nrof_candidates_sfi.aggregation_level4_present) {
          HANDLE_CODE(c.get<common_s_>().dci_format2_0.nrof_candidates_sfi.aggregation_level4.pack(bref));
        }
        if (c.get<common_s_>().dci_format2_0.nrof_candidates_sfi.aggregation_level8_present) {
          HANDLE_CODE(c.get<common_s_>().dci_format2_0.nrof_candidates_sfi.aggregation_level8.pack(bref));
        }
        if (c.get<common_s_>().dci_format2_0.nrof_candidates_sfi.aggregation_level16_present) {
          HANDLE_CODE(c.get<common_s_>().dci_format2_0.nrof_candidates_sfi.aggregation_level16.pack(bref));
        }
      }
      if (c.get<common_s_>().dci_format2_1_present) {
        bref.pack(c.get<common_s_>().dci_format2_1.ext, 1);
      }
      if (c.get<common_s_>().dci_format2_2_present) {
        bref.pack(c.get<common_s_>().dci_format2_2.ext, 1);
      }
      if (c.get<common_s_>().dci_format2_3_present) {
        bref.pack(c.get<common_s_>().dci_format2_3.ext, 1);
        HANDLE_CODE(bref.pack(c.get<common_s_>().dci_format2_3.dummy1_present, 1));
        if (c.get<common_s_>().dci_format2_3.dummy1_present) {
          HANDLE_CODE(c.get<common_s_>().dci_format2_3.dummy1.pack(bref));
        }
        HANDLE_CODE(c.get<common_s_>().dci_format2_3.dummy2.pack(bref));
      }
      break;
    case types::ue_specific:
      HANDLE_CODE(c.get<ue_specific_s_>().pack(bref));
      break;
    default:
      log_invalid_choice_id(type_, "search_space_s::search_space_type_c_");
      return SRSASN_ERROR_ENCODE_FAIL;
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE search_space_s::search_space_type_c_::unpack(cbit_ref& bref)
{
  types e;
  e.unpack(bref);
  set(e);
  switch (type_) {
    case types::common:
      HANDLE_CODE(bref.unpack(c.get<common_s_>().dci_format0_0_and_format1_0_present, 1));
      HANDLE_CODE(bref.unpack(c.get<common_s_>().dci_format2_0_present, 1));
      HANDLE_CODE(bref.unpack(c.get<common_s_>().dci_format2_1_present, 1));
      HANDLE_CODE(bref.unpack(c.get<common_s_>().dci_format2_2_present, 1));
      HANDLE_CODE(bref.unpack(c.get<common_s_>().dci_format2_3_present, 1));
      if (c.get<common_s_>().dci_format0_0_and_format1_0_present) {
        bref.unpack(c.get<common_s_>().dci_format0_0_and_format1_0.ext, 1);
      }
      if (c.get<common_s_>().dci_format2_0_present) {
        bref.unpack(c.get<common_s_>().dci_format2_0.ext, 1);
        HANDLE_CODE(bref.unpack(c.get<common_s_>().dci_format2_0.nrof_candidates_sfi.aggregation_level1_present, 1));
        HANDLE_CODE(bref.unpack(c.get<common_s_>().dci_format2_0.nrof_candidates_sfi.aggregation_level2_present, 1));
        HANDLE_CODE(bref.unpack(c.get<common_s_>().dci_format2_0.nrof_candidates_sfi.aggregation_level4_present, 1));
        HANDLE_CODE(bref.unpack(c.get<common_s_>().dci_format2_0.nrof_candidates_sfi.aggregation_level8_present, 1));
        HANDLE_CODE(bref.unpack(c.get<common_s_>().dci_format2_0.nrof_candidates_sfi.aggregation_level16_present, 1));
        if (c.get<common_s_>().dci_format2_0.nrof_candidates_sfi.aggregation_level1_present) {
          HANDLE_CODE(c.get<common_s_>().dci_format2_0.nrof_candidates_sfi.aggregation_level1.unpack(bref));
        }
        if (c.get<common_s_>().dci_format2_0.nrof_candidates_sfi.aggregation_level2_present) {
          HANDLE_CODE(c.get<common_s_>().dci_format2_0.nrof_candidates_sfi.aggregation_level2.unpack(bref));
        }
        if (c.get<common_s_>().dci_format2_0.nrof_candidates_sfi.aggregation_level4_present) {
          HANDLE_CODE(c.get<common_s_>().dci_format2_0.nrof_candidates_sfi.aggregation_level4.unpack(bref));
        }
        if (c.get<common_s_>().dci_format2_0.nrof_candidates_sfi.aggregation_level8_present) {
          HANDLE_CODE(c.get<common_s_>().dci_format2_0.nrof_candidates_sfi.aggregation_level8.unpack(bref));
        }
        if (c.get<common_s_>().dci_format2_0.nrof_candidates_sfi.aggregation_level16_present) {
          HANDLE_CODE(c.get<common_s_>().dci_format2_0.nrof_candidates_sfi.aggregation_level16.unpack(bref));
        }
      }
      if (c.get<common_s_>().dci_format2_1_present) {
        bref.unpack(c.get<common_s_>().dci_format2_1.ext, 1);
      }
      if (c.get<common_s_>().dci_format2_2_present) {
        bref.unpack(c.get<common_s_>().dci_format2_2.ext, 1);
      }
      if (c.get<common_s_>().dci_format2_3_present) {
        bref.unpack(c.get<common_s_>().dci_format2_3.ext, 1);
        HANDLE_CODE(bref.unpack(c.get<common_s_>().dci_format2_3.dummy1_present, 1));
        if (c.get<common_s_>().dci_format2_3.dummy1_present) {
          HANDLE_CODE(c.get<common_s_>().dci_format2_3.dummy1.unpack(bref));
        }
        HANDLE_CODE(c.get<common_s_>().dci_format2_3.dummy2.unpack(bref));
      }
      break;
    case types::ue_specific:
      HANDLE_CODE(c.get<ue_specific_s_>().unpack(bref));
      break;
    default:
      log_invalid_choice_id(type_, "search_space_s::search_space_type_c_");
      return SRSASN_ERROR_DECODE_FAIL;
  }
  return SRSASN_SUCCESS;
}

const char* search_space_s::search_space_type_c_::common_s_::dci_format2_0_s_::nrof_candidates_sfi_s_::
    aggregation_level1_opts::to_string() const
{
  static const char* names[] = {"n1", "n2"};
  return convert_enum_idx(names,
                          2,
                          value,
                          "search_space_s::search_space_type_c_::common_s_::dci_format2_0_s_::nrof_candidates_sfi_s_::"
                          "aggregation_level1_e_");
}
uint8_t search_space_s::search_space_type_c_::common_s_::dci_format2_0_s_::nrof_candidates_sfi_s_::
    aggregation_level1_opts::to_number() const
{
  static const uint8_t numbers[] = {1, 2};
  return map_enum_number(numbers,
                         2,
                         value,
                         "search_space_s::search_space_type_c_::common_s_::dci_format2_0_s_::nrof_candidates_sfi_s_::"
                         "aggregation_level1_e_");
}

const char* search_space_s::search_space_type_c_::common_s_::dci_format2_0_s_::nrof_candidates_sfi_s_::
    aggregation_level2_opts::to_string() const
{
  static const char* names[] = {"n1", "n2"};
  return convert_enum_idx(names,
                          2,
                          value,
                          "search_space_s::search_space_type_c_::common_s_::dci_format2_0_s_::nrof_candidates_sfi_s_::"
                          "aggregation_level2_e_");
}
uint8_t search_space_s::search_space_type_c_::common_s_::dci_format2_0_s_::nrof_candidates_sfi_s_::
    aggregation_level2_opts::to_number() const
{
  static const uint8_t numbers[] = {1, 2};
  return map_enum_number(numbers,
                         2,
                         value,
                         "search_space_s::search_space_type_c_::common_s_::dci_format2_0_s_::nrof_candidates_sfi_s_::"
                         "aggregation_level2_e_");
}

const char* search_space_s::search_space_type_c_::common_s_::dci_format2_0_s_::nrof_candidates_sfi_s_::
    aggregation_level4_opts::to_string() const
{
  static const char* names[] = {"n1", "n2"};
  return convert_enum_idx(names,
                          2,
                          value,
                          "search_space_s::search_space_type_c_::common_s_::dci_format2_0_s_::nrof_candidates_sfi_s_::"
                          "aggregation_level4_e_");
}
uint8_t search_space_s::search_space_type_c_::common_s_::dci_format2_0_s_::nrof_candidates_sfi_s_::
    aggregation_level4_opts::to_number() const
{
  static const uint8_t numbers[] = {1, 2};
  return map_enum_number(numbers,
                         2,
                         value,
                         "search_space_s::search_space_type_c_::common_s_::dci_format2_0_s_::nrof_candidates_sfi_s_::"
                         "aggregation_level4_e_");
}

const char* search_space_s::search_space_type_c_::common_s_::dci_format2_0_s_::nrof_candidates_sfi_s_::
    aggregation_level8_opts::to_string() const
{
  static const char* names[] = {"n1", "n2"};
  return convert_enum_idx(names,
                          2,
                          value,
                          "search_space_s::search_space_type_c_::common_s_::dci_format2_0_s_::nrof_candidates_sfi_s_::"
                          "aggregation_level8_e_");
}
uint8_t search_space_s::search_space_type_c_::common_s_::dci_format2_0_s_::nrof_candidates_sfi_s_::
    aggregation_level8_opts::to_number() const
{
  static const uint8_t numbers[] = {1, 2};
  return map_enum_number(numbers,
                         2,
                         value,
                         "search_space_s::search_space_type_c_::common_s_::dci_format2_0_s_::nrof_candidates_sfi_s_::"
                         "aggregation_level8_e_");
}

const char* search_space_s::search_space_type_c_::common_s_::dci_format2_0_s_::nrof_candidates_sfi_s_::
    aggregation_level16_opts::to_string() const
{
  static const char* names[] = {"n1", "n2"};
  return convert_enum_idx(names,
                          2,
                          value,
                          "search_space_s::search_space_type_c_::common_s_::dci_format2_0_s_::nrof_candidates_sfi_s_::"
                          "aggregation_level16_e_");
}
uint8_t search_space_s::search_space_type_c_::common_s_::dci_format2_0_s_::nrof_candidates_sfi_s_::
    aggregation_level16_opts::to_number() const
{
  static const uint8_t numbers[] = {1, 2};
  return map_enum_number(numbers,
                         2,
                         value,
                         "search_space_s::search_space_type_c_::common_s_::dci_format2_0_s_::nrof_candidates_sfi_s_::"
                         "aggregation_level16_e_");
}

const char* search_space_s::search_space_type_c_::common_s_::dci_format2_3_s_::dummy1_opts::to_string() const
{
  static const char* names[] = {"sl1", "sl2", "sl4", "sl5", "sl8", "sl10", "sl16", "sl20"};
  return convert_enum_idx(
      names, 8, value, "search_space_s::search_space_type_c_::common_s_::dci_format2_3_s_::dummy1_e_");
}
uint8_t search_space_s::search_space_type_c_::common_s_::dci_format2_3_s_::dummy1_opts::to_number() const
{
  static const uint8_t numbers[] = {1, 2, 4, 5, 8, 10, 16, 20};
  return map_enum_number(
      numbers, 8, value, "search_space_s::search_space_type_c_::common_s_::dci_format2_3_s_::dummy1_e_");
}

const char* search_space_s::search_space_type_c_::common_s_::dci_format2_3_s_::dummy2_opts::to_string() const
{
  static const char* names[] = {"n1", "n2"};
  return convert_enum_idx(
      names, 2, value, "search_space_s::search_space_type_c_::common_s_::dci_format2_3_s_::dummy2_e_");
}
uint8_t search_space_s::search_space_type_c_::common_s_::dci_format2_3_s_::dummy2_opts::to_number() const
{
  static const uint8_t numbers[] = {1, 2};
  return map_enum_number(
      numbers, 2, value, "search_space_s::search_space_type_c_::common_s_::dci_format2_3_s_::dummy2_e_");
}

SRSASN_CODE search_space_s::search_space_type_c_::ue_specific_s_::pack(bit_ref& bref) const
{
  bref.pack(ext, 1);
  HANDLE_CODE(dci_formats.pack(bref));

  if (ext) {
    ext_groups_packer_guard group_flags;
    group_flags[0] |= dci_formats_mt_r16_present;
    group_flags[0] |= dci_formats_sl_r16_present;
    group_flags[0] |= dci_formats_ext_r16_present;
    group_flags.pack(bref);

    if (group_flags[0]) {
      varlength_field_pack_guard varlen_scope(bref, false);

      HANDLE_CODE(bref.pack(dci_formats_mt_r16_present, 1));
      HANDLE_CODE(bref.pack(dci_formats_sl_r16_present, 1));
      HANDLE_CODE(bref.pack(dci_formats_ext_r16_present, 1));
      if (dci_formats_sl_r16_present) {
        HANDLE_CODE(dci_formats_sl_r16.pack(bref));
      }
      if (dci_formats_ext_r16_present) {
        HANDLE_CODE(dci_formats_ext_r16.pack(bref));
      }
    }
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE search_space_s::search_space_type_c_::ue_specific_s_::unpack(cbit_ref& bref)
{
  bref.unpack(ext, 1);
  HANDLE_CODE(dci_formats.unpack(bref));

  if (ext) {
    ext_groups_unpacker_guard group_flags(1);
    group_flags.unpack(bref);

    if (group_flags[0]) {
      varlength_field_unpack_guard varlen_scope(bref, false);

      HANDLE_CODE(bref.unpack(dci_formats_mt_r16_present, 1));
      HANDLE_CODE(bref.unpack(dci_formats_sl_r16_present, 1));
      HANDLE_CODE(bref.unpack(dci_formats_ext_r16_present, 1));
      if (dci_formats_sl_r16_present) {
        HANDLE_CODE(dci_formats_sl_r16.unpack(bref));
      }
      if (dci_formats_ext_r16_present) {
        HANDLE_CODE(dci_formats_ext_r16.unpack(bref));
      }
    }
  }
  return SRSASN_SUCCESS;
}
void search_space_s::search_space_type_c_::ue_specific_s_::to_json(json_writer& j) const
{
  j.start_obj();
  j.write_str("dci-Formats", dci_formats.to_string());
  if (ext) {
    if (dci_formats_mt_r16_present) {
      j.write_str("dci-Formats-MT-r16", "formats2-5");
    }
    if (dci_formats_sl_r16_present) {
      j.write_str("dci-FormatsSL-r16", dci_formats_sl_r16.to_string());
    }
    if (dci_formats_ext_r16_present) {
      j.write_str("dci-FormatsExt-r16", dci_formats_ext_r16.to_string());
    }
  }
  j.end_obj();
}

const char* search_space_s::search_space_type_c_::ue_specific_s_::dci_formats_opts::to_string() const
{
  static const char* names[] = {"formats0-0-And-1-0", "formats0-1-And-1-1"};
  return convert_enum_idx(names, 2, value, "search_space_s::search_space_type_c_::ue_specific_s_::dci_formats_e_");
}

const char* search_space_s::search_space_type_c_::ue_specific_s_::dci_formats_sl_r16_opts::to_string() const
{
  static const char* names[] = {
      "formats0-0-And-1-0", "formats0-1-And-1-1", "formats3-0", "formats3-1", "formats3-0-And-3-1"};
  return convert_enum_idx(
      names, 5, value, "search_space_s::search_space_type_c_::ue_specific_s_::dci_formats_sl_r16_e_");
}

const char* search_space_s::search_space_type_c_::ue_specific_s_::dci_formats_ext_r16_opts::to_string() const
{
  static const char* names[] = {"formats0-2-And-1-2", "formats0-1-And-1-1And-0-2-And-1-2"};
  return convert_enum_idx(
      names, 2, value, "search_space_s::search_space_type_c_::ue_specific_s_::dci_formats_ext_r16_e_");
}

const char* search_space_s::search_space_type_c_::types_opts::to_string() const
{
  static const char* names[] = {"common", "ue-Specific"};
  return convert_enum_idx(names, 2, value, "search_space_s::search_space_type_c_::types");
}

// SearchSpaceExt-r16 ::= SEQUENCE
SRSASN_CODE search_space_ext_r16_s::pack(bit_ref& bref) const
{
  HANDLE_CODE(bref.pack(coreset_id_r16_present, 1));
  HANDLE_CODE(bref.pack(search_space_type_r16_present, 1));
  HANDLE_CODE(bref.pack(search_space_group_id_list_r16.size() > 0, 1));
  HANDLE_CODE(bref.pack(freq_monitor_locations_r16_present, 1));

  if (coreset_id_r16_present) {
    HANDLE_CODE(pack_integer(bref, coreset_id_r16, (uint8_t)0u, (uint8_t)15u));
  }
  if (search_space_type_r16_present) {
    bref.pack(search_space_type_r16.common_r16.ext, 1);
    HANDLE_CODE(bref.pack(search_space_type_r16.common_r16.dci_format2_4_r16_present, 1));
    HANDLE_CODE(bref.pack(search_space_type_r16.common_r16.dci_format2_5_r16_present, 1));
    HANDLE_CODE(bref.pack(search_space_type_r16.common_r16.dci_format2_6_r16_present, 1));
    if (search_space_type_r16.common_r16.dci_format2_4_r16_present) {
      bref.pack(search_space_type_r16.common_r16.dci_format2_4_r16.ext, 1);
      HANDLE_CODE(bref.pack(
          search_space_type_r16.common_r16.dci_format2_4_r16.nrof_candidates_ci_r16.aggregation_level1_r16_present, 1));
      HANDLE_CODE(bref.pack(
          search_space_type_r16.common_r16.dci_format2_4_r16.nrof_candidates_ci_r16.aggregation_level2_r16_present, 1));
      HANDLE_CODE(bref.pack(
          search_space_type_r16.common_r16.dci_format2_4_r16.nrof_candidates_ci_r16.aggregation_level4_r16_present, 1));
      HANDLE_CODE(bref.pack(
          search_space_type_r16.common_r16.dci_format2_4_r16.nrof_candidates_ci_r16.aggregation_level8_r16_present, 1));
      HANDLE_CODE(bref.pack(
          search_space_type_r16.common_r16.dci_format2_4_r16.nrof_candidates_ci_r16.aggregation_level16_r16_present,
          1));
      if (search_space_type_r16.common_r16.dci_format2_4_r16.nrof_candidates_ci_r16.aggregation_level1_r16_present) {
        HANDLE_CODE(
            search_space_type_r16.common_r16.dci_format2_4_r16.nrof_candidates_ci_r16.aggregation_level1_r16.pack(
                bref));
      }
      if (search_space_type_r16.common_r16.dci_format2_4_r16.nrof_candidates_ci_r16.aggregation_level2_r16_present) {
        HANDLE_CODE(
            search_space_type_r16.common_r16.dci_format2_4_r16.nrof_candidates_ci_r16.aggregation_level2_r16.pack(
                bref));
      }
      if (search_space_type_r16.common_r16.dci_format2_4_r16.nrof_candidates_ci_r16.aggregation_level4_r16_present) {
        HANDLE_CODE(
            search_space_type_r16.common_r16.dci_format2_4_r16.nrof_candidates_ci_r16.aggregation_level4_r16.pack(
                bref));
      }
      if (search_space_type_r16.common_r16.dci_format2_4_r16.nrof_candidates_ci_r16.aggregation_level8_r16_present) {
        HANDLE_CODE(
            search_space_type_r16.common_r16.dci_format2_4_r16.nrof_candidates_ci_r16.aggregation_level8_r16.pack(
                bref));
      }
      if (search_space_type_r16.common_r16.dci_format2_4_r16.nrof_candidates_ci_r16.aggregation_level16_r16_present) {
        HANDLE_CODE(
            search_space_type_r16.common_r16.dci_format2_4_r16.nrof_candidates_ci_r16.aggregation_level16_r16.pack(
                bref));
      }
    }
    if (search_space_type_r16.common_r16.dci_format2_5_r16_present) {
      bref.pack(search_space_type_r16.common_r16.dci_format2_5_r16.ext, 1);
      HANDLE_CODE(bref.pack(
          search_space_type_r16.common_r16.dci_format2_5_r16.nrof_candidates_iab_r16.aggregation_level1_r16_present,
          1));
      HANDLE_CODE(bref.pack(
          search_space_type_r16.common_r16.dci_format2_5_r16.nrof_candidates_iab_r16.aggregation_level2_r16_present,
          1));
      HANDLE_CODE(bref.pack(
          search_space_type_r16.common_r16.dci_format2_5_r16.nrof_candidates_iab_r16.aggregation_level4_r16_present,
          1));
      HANDLE_CODE(bref.pack(
          search_space_type_r16.common_r16.dci_format2_5_r16.nrof_candidates_iab_r16.aggregation_level8_r16_present,
          1));
      HANDLE_CODE(bref.pack(
          search_space_type_r16.common_r16.dci_format2_5_r16.nrof_candidates_iab_r16.aggregation_level16_r16_present,
          1));
      if (search_space_type_r16.common_r16.dci_format2_5_r16.nrof_candidates_iab_r16.aggregation_level1_r16_present) {
        HANDLE_CODE(
            search_space_type_r16.common_r16.dci_format2_5_r16.nrof_candidates_iab_r16.aggregation_level1_r16.pack(
                bref));
      }
      if (search_space_type_r16.common_r16.dci_format2_5_r16.nrof_candidates_iab_r16.aggregation_level2_r16_present) {
        HANDLE_CODE(
            search_space_type_r16.common_r16.dci_format2_5_r16.nrof_candidates_iab_r16.aggregation_level2_r16.pack(
                bref));
      }
      if (search_space_type_r16.common_r16.dci_format2_5_r16.nrof_candidates_iab_r16.aggregation_level4_r16_present) {
        HANDLE_CODE(
            search_space_type_r16.common_r16.dci_format2_5_r16.nrof_candidates_iab_r16.aggregation_level4_r16.pack(
                bref));
      }
      if (search_space_type_r16.common_r16.dci_format2_5_r16.nrof_candidates_iab_r16.aggregation_level8_r16_present) {
        HANDLE_CODE(
            search_space_type_r16.common_r16.dci_format2_5_r16.nrof_candidates_iab_r16.aggregation_level8_r16.pack(
                bref));
      }
      if (search_space_type_r16.common_r16.dci_format2_5_r16.nrof_candidates_iab_r16.aggregation_level16_r16_present) {
        HANDLE_CODE(
            search_space_type_r16.common_r16.dci_format2_5_r16.nrof_candidates_iab_r16.aggregation_level16_r16.pack(
                bref));
      }
    }
    if (search_space_type_r16.common_r16.dci_format2_6_r16_present) {
      bref.pack(search_space_type_r16.common_r16.dci_format2_6_r16.ext, 1);
    }
  }
  if (search_space_group_id_list_r16.size() > 0) {
    HANDLE_CODE(pack_dyn_seq_of(bref, search_space_group_id_list_r16, 1, 2, integer_packer<uint8_t>(0, 1)));
  }
  if (freq_monitor_locations_r16_present) {
    HANDLE_CODE(freq_monitor_locations_r16.pack(bref));
  }

  return SRSASN_SUCCESS;
}
SRSASN_CODE search_space_ext_r16_s::unpack(cbit_ref& bref)
{
  HANDLE_CODE(bref.unpack(coreset_id_r16_present, 1));
  HANDLE_CODE(bref.unpack(search_space_type_r16_present, 1));
  bool search_space_group_id_list_r16_present;
  HANDLE_CODE(bref.unpack(search_space_group_id_list_r16_present, 1));
  HANDLE_CODE(bref.unpack(freq_monitor_locations_r16_present, 1));

  if (coreset_id_r16_present) {
    HANDLE_CODE(unpack_integer(coreset_id_r16, bref, (uint8_t)0u, (uint8_t)15u));
  }
  if (search_space_type_r16_present) {
    bref.unpack(search_space_type_r16.common_r16.ext, 1);
    HANDLE_CODE(bref.unpack(search_space_type_r16.common_r16.dci_format2_4_r16_present, 1));
    HANDLE_CODE(bref.unpack(search_space_type_r16.common_r16.dci_format2_5_r16_present, 1));
    HANDLE_CODE(bref.unpack(search_space_type_r16.common_r16.dci_format2_6_r16_present, 1));
    if (search_space_type_r16.common_r16.dci_format2_4_r16_present) {
      bref.unpack(search_space_type_r16.common_r16.dci_format2_4_r16.ext, 1);
      HANDLE_CODE(bref.unpack(
          search_space_type_r16.common_r16.dci_format2_4_r16.nrof_candidates_ci_r16.aggregation_level1_r16_present, 1));
      HANDLE_CODE(bref.unpack(
          search_space_type_r16.common_r16.dci_format2_4_r16.nrof_candidates_ci_r16.aggregation_level2_r16_present, 1));
      HANDLE_CODE(bref.unpack(
          search_space_type_r16.common_r16.dci_format2_4_r16.nrof_candidates_ci_r16.aggregation_level4_r16_present, 1));
      HANDLE_CODE(bref.unpack(
          search_space_type_r16.common_r16.dci_format2_4_r16.nrof_candidates_ci_r16.aggregation_level8_r16_present, 1));
      HANDLE_CODE(bref.unpack(
          search_space_type_r16.common_r16.dci_format2_4_r16.nrof_candidates_ci_r16.aggregation_level16_r16_present,
          1));
      if (search_space_type_r16.common_r16.dci_format2_4_r16.nrof_candidates_ci_r16.aggregation_level1_r16_present) {
        HANDLE_CODE(
            search_space_type_r16.common_r16.dci_format2_4_r16.nrof_candidates_ci_r16.aggregation_level1_r16.unpack(
                bref));
      }
      if (search_space_type_r16.common_r16.dci_format2_4_r16.nrof_candidates_ci_r16.aggregation_level2_r16_present) {
        HANDLE_CODE(
            search_space_type_r16.common_r16.dci_format2_4_r16.nrof_candidates_ci_r16.aggregation_level2_r16.unpack(
                bref));
      }
      if (search_space_type_r16.common_r16.dci_format2_4_r16.nrof_candidates_ci_r16.aggregation_level4_r16_present) {
        HANDLE_CODE(
            search_space_type_r16.common_r16.dci_format2_4_r16.nrof_candidates_ci_r16.aggregation_level4_r16.unpack(
                bref));
      }
      if (search_space_type_r16.common_r16.dci_format2_4_r16.nrof_candidates_ci_r16.aggregation_level8_r16_present) {
        HANDLE_CODE(
            search_space_type_r16.common_r16.dci_format2_4_r16.nrof_candidates_ci_r16.aggregation_level8_r16.unpack(
                bref));
      }
      if (search_space_type_r16.common_r16.dci_format2_4_r16.nrof_candidates_ci_r16.aggregation_level16_r16_present) {
        HANDLE_CODE(
            search_space_type_r16.common_r16.dci_format2_4_r16.nrof_candidates_ci_r16.aggregation_level16_r16.unpack(
                bref));
      }
    }
    if (search_space_type_r16.common_r16.dci_format2_5_r16_present) {
      bref.unpack(search_space_type_r16.common_r16.dci_format2_5_r16.ext, 1);
      HANDLE_CODE(bref.unpack(
          search_space_type_r16.common_r16.dci_format2_5_r16.nrof_candidates_iab_r16.aggregation_level1_r16_present,
          1));
      HANDLE_CODE(bref.unpack(
          search_space_type_r16.common_r16.dci_format2_5_r16.nrof_candidates_iab_r16.aggregation_level2_r16_present,
          1));
      HANDLE_CODE(bref.unpack(
          search_space_type_r16.common_r16.dci_format2_5_r16.nrof_candidates_iab_r16.aggregation_level4_r16_present,
          1));
      HANDLE_CODE(bref.unpack(
          search_space_type_r16.common_r16.dci_format2_5_r16.nrof_candidates_iab_r16.aggregation_level8_r16_present,
          1));
      HANDLE_CODE(bref.unpack(
          search_space_type_r16.common_r16.dci_format2_5_r16.nrof_candidates_iab_r16.aggregation_level16_r16_present,
          1));
      if (search_space_type_r16.common_r16.dci_format2_5_r16.nrof_candidates_iab_r16.aggregation_level1_r16_present) {
        HANDLE_CODE(
            search_space_type_r16.common_r16.dci_format2_5_r16.nrof_candidates_iab_r16.aggregation_level1_r16.unpack(
                bref));
      }
      if (search_space_type_r16.common_r16.dci_format2_5_r16.nrof_candidates_iab_r16.aggregation_level2_r16_present) {
        HANDLE_CODE(
            search_space_type_r16.common_r16.dci_format2_5_r16.nrof_candidates_iab_r16.aggregation_level2_r16.unpack(
                bref));
      }
      if (search_space_type_r16.common_r16.dci_format2_5_r16.nrof_candidates_iab_r16.aggregation_level4_r16_present) {
        HANDLE_CODE(
            search_space_type_r16.common_r16.dci_format2_5_r16.nrof_candidates_iab_r16.aggregation_level4_r16.unpack(
                bref));
      }
      if (search_space_type_r16.common_r16.dci_format2_5_r16.nrof_candidates_iab_r16.aggregation_level8_r16_present) {
        HANDLE_CODE(
            search_space_type_r16.common_r16.dci_format2_5_r16.nrof_candidates_iab_r16.aggregation_level8_r16.unpack(
                bref));
      }
      if (search_space_type_r16.common_r16.dci_format2_5_r16.nrof_candidates_iab_r16.aggregation_level16_r16_present) {
        HANDLE_CODE(
            search_space_type_r16.common_r16.dci_format2_5_r16.nrof_candidates_iab_r16.aggregation_level16_r16.unpack(
                bref));
      }
    }
    if (search_space_type_r16.common_r16.dci_format2_6_r16_present) {
      bref.unpack(search_space_type_r16.common_r16.dci_format2_6_r16.ext, 1);
    }
  }
  if (search_space_group_id_list_r16_present) {
    HANDLE_CODE(unpack_dyn_seq_of(search_space_group_id_list_r16, bref, 1, 2, integer_packer<uint8_t>(0, 1)));
  }
  if (freq_monitor_locations_r16_present) {
    HANDLE_CODE(freq_monitor_locations_r16.unpack(bref));
  }

  return SRSASN_SUCCESS;
}
void search_space_ext_r16_s::to_json(json_writer& j) const
{
  j.start_obj();
  if (coreset_id_r16_present) {
    j.write_int("controlResourceSetId-r16", coreset_id_r16);
  }
  if (search_space_type_r16_present) {
    j.write_fieldname("searchSpaceType-r16");
    j.start_obj();
    j.write_fieldname("common-r16");
    j.start_obj();
    if (search_space_type_r16.common_r16.dci_format2_4_r16_present) {
      j.write_fieldname("dci-Format2-4-r16");
      j.start_obj();
      j.write_fieldname("nrofCandidates-CI-r16");
      j.start_obj();
      if (search_space_type_r16.common_r16.dci_format2_4_r16.nrof_candidates_ci_r16.aggregation_level1_r16_present) {
        j.write_str("aggregationLevel1-r16",
                    search_space_type_r16.common_r16.dci_format2_4_r16.nrof_candidates_ci_r16.aggregation_level1_r16
                        .to_string());
      }
      if (search_space_type_r16.common_r16.dci_format2_4_r16.nrof_candidates_ci_r16.aggregation_level2_r16_present) {
        j.write_str("aggregationLevel2-r16",
                    search_space_type_r16.common_r16.dci_format2_4_r16.nrof_candidates_ci_r16.aggregation_level2_r16
                        .to_string());
      }
      if (search_space_type_r16.common_r16.dci_format2_4_r16.nrof_candidates_ci_r16.aggregation_level4_r16_present) {
        j.write_str("aggregationLevel4-r16",
                    search_space_type_r16.common_r16.dci_format2_4_r16.nrof_candidates_ci_r16.aggregation_level4_r16
                        .to_string());
      }
      if (search_space_type_r16.common_r16.dci_format2_4_r16.nrof_candidates_ci_r16.aggregation_level8_r16_present) {
        j.write_str("aggregationLevel8-r16",
                    search_space_type_r16.common_r16.dci_format2_4_r16.nrof_candidates_ci_r16.aggregation_level8_r16
                        .to_string());
      }
      if (search_space_type_r16.common_r16.dci_format2_4_r16.nrof_candidates_ci_r16.aggregation_level16_r16_present) {
        j.write_str("aggregationLevel16-r16",
                    search_space_type_r16.common_r16.dci_format2_4_r16.nrof_candidates_ci_r16.aggregation_level16_r16
                        .to_string());
      }
      j.end_obj();
      j.end_obj();
    }
    if (search_space_type_r16.common_r16.dci_format2_5_r16_present) {
      j.write_fieldname("dci-Format2-5-r16");
      j.start_obj();
      j.write_fieldname("nrofCandidates-IAB-r16");
      j.start_obj();
      if (search_space_type_r16.common_r16.dci_format2_5_r16.nrof_candidates_iab_r16.aggregation_level1_r16_present) {
        j.write_str("aggregationLevel1-r16",
                    search_space_type_r16.common_r16.dci_format2_5_r16.nrof_candidates_iab_r16.aggregation_level1_r16
                        .to_string());
      }
      if (search_space_type_r16.common_r16.dci_format2_5_r16.nrof_candidates_iab_r16.aggregation_level2_r16_present) {
        j.write_str("aggregationLevel2-r16",
                    search_space_type_r16.common_r16.dci_format2_5_r16.nrof_candidates_iab_r16.aggregation_level2_r16
                        .to_string());
      }
      if (search_space_type_r16.common_r16.dci_format2_5_r16.nrof_candidates_iab_r16.aggregation_level4_r16_present) {
        j.write_str("aggregationLevel4-r16",
                    search_space_type_r16.common_r16.dci_format2_5_r16.nrof_candidates_iab_r16.aggregation_level4_r16
                        .to_string());
      }
      if (search_space_type_r16.common_r16.dci_format2_5_r16.nrof_candidates_iab_r16.aggregation_level8_r16_present) {
        j.write_str("aggregationLevel8-r16",
                    search_space_type_r16.common_r16.dci_format2_5_r16.nrof_candidates_iab_r16.aggregation_level8_r16
                        .to_string());
      }
      if (search_space_type_r16.common_r16.dci_format2_5_r16.nrof_candidates_iab_r16.aggregation_level16_r16_present) {
        j.write_str("aggregationLevel16-r16",
                    search_space_type_r16.common_r16.dci_format2_5_r16.nrof_candidates_iab_r16.aggregation_level16_r16
                        .to_string());
      }
      j.end_obj();
      j.end_obj();
    }
    if (search_space_type_r16.common_r16.dci_format2_6_r16_present) {
      j.write_fieldname("dci-Format2-6-r16");
      j.start_obj();
      j.end_obj();
    }
    j.end_obj();
    j.end_obj();
  }
  if (search_space_group_id_list_r16.size() > 0) {
    j.start_array("searchSpaceGroupIdList-r16");
    for (const auto& e1 : search_space_group_id_list_r16) {
      j.write_int(e1);
    }
    j.end_array();
  }
  if (freq_monitor_locations_r16_present) {
    j.write_str("freqMonitorLocations-r16", freq_monitor_locations_r16.to_string());
  }
  j.end_obj();
}

const char* search_space_ext_r16_s::search_space_type_r16_s_::common_r16_s_::dci_format2_4_r16_s_::
    nrof_candidates_ci_r16_s_::aggregation_level1_r16_opts::to_string() const
{
  static const char* names[] = {"n1", "n2"};
  return convert_enum_idx(names,
                          2,
                          value,
                          "search_space_ext_r16_s::search_space_type_r16_s_::common_r16_s_::dci_format2_4_r16_s_::nrof_"
                          "candidates_ci_r16_s_::aggregation_level1_r16_e_");
}
uint8_t search_space_ext_r16_s::search_space_type_r16_s_::common_r16_s_::dci_format2_4_r16_s_::
    nrof_candidates_ci_r16_s_::aggregation_level1_r16_opts::to_number() const
{
  static const uint8_t numbers[] = {1, 2};
  return map_enum_number(numbers,
                         2,
                         value,
                         "search_space_ext_r16_s::search_space_type_r16_s_::common_r16_s_::dci_format2_4_r16_s_::nrof_"
                         "candidates_ci_r16_s_::aggregation_level1_r16_e_");
}

const char* search_space_ext_r16_s::search_space_type_r16_s_::common_r16_s_::dci_format2_4_r16_s_::
    nrof_candidates_ci_r16_s_::aggregation_level2_r16_opts::to_string() const
{
  static const char* names[] = {"n1", "n2"};
  return convert_enum_idx(names,
                          2,
                          value,
                          "search_space_ext_r16_s::search_space_type_r16_s_::common_r16_s_::dci_format2_4_r16_s_::nrof_"
                          "candidates_ci_r16_s_::aggregation_level2_r16_e_");
}
uint8_t search_space_ext_r16_s::search_space_type_r16_s_::common_r16_s_::dci_format2_4_r16_s_::
    nrof_candidates_ci_r16_s_::aggregation_level2_r16_opts::to_number() const
{
  static const uint8_t numbers[] = {1, 2};
  return map_enum_number(numbers,
                         2,
                         value,
                         "search_space_ext_r16_s::search_space_type_r16_s_::common_r16_s_::dci_format2_4_r16_s_::nrof_"
                         "candidates_ci_r16_s_::aggregation_level2_r16_e_");
}

const char* search_space_ext_r16_s::search_space_type_r16_s_::common_r16_s_::dci_format2_4_r16_s_::
    nrof_candidates_ci_r16_s_::aggregation_level4_r16_opts::to_string() const
{
  static const char* names[] = {"n1", "n2"};
  return convert_enum_idx(names,
                          2,
                          value,
                          "search_space_ext_r16_s::search_space_type_r16_s_::common_r16_s_::dci_format2_4_r16_s_::nrof_"
                          "candidates_ci_r16_s_::aggregation_level4_r16_e_");
}
uint8_t search_space_ext_r16_s::search_space_type_r16_s_::common_r16_s_::dci_format2_4_r16_s_::
    nrof_candidates_ci_r16_s_::aggregation_level4_r16_opts::to_number() const
{
  static const uint8_t numbers[] = {1, 2};
  return map_enum_number(numbers,
                         2,
                         value,
                         "search_space_ext_r16_s::search_space_type_r16_s_::common_r16_s_::dci_format2_4_r16_s_::nrof_"
                         "candidates_ci_r16_s_::aggregation_level4_r16_e_");
}

const char* search_space_ext_r16_s::search_space_type_r16_s_::common_r16_s_::dci_format2_4_r16_s_::
    nrof_candidates_ci_r16_s_::aggregation_level8_r16_opts::to_string() const
{
  static const char* names[] = {"n1", "n2"};
  return convert_enum_idx(names,
                          2,
                          value,
                          "search_space_ext_r16_s::search_space_type_r16_s_::common_r16_s_::dci_format2_4_r16_s_::nrof_"
                          "candidates_ci_r16_s_::aggregation_level8_r16_e_");
}
uint8_t search_space_ext_r16_s::search_space_type_r16_s_::common_r16_s_::dci_format2_4_r16_s_::
    nrof_candidates_ci_r16_s_::aggregation_level8_r16_opts::to_number() const
{
  static const uint8_t numbers[] = {1, 2};
  return map_enum_number(numbers,
                         2,
                         value,
                         "search_space_ext_r16_s::search_space_type_r16_s_::common_r16_s_::dci_format2_4_r16_s_::nrof_"
                         "candidates_ci_r16_s_::aggregation_level8_r16_e_");
}

const char* search_space_ext_r16_s::search_space_type_r16_s_::common_r16_s_::dci_format2_4_r16_s_::
    nrof_candidates_ci_r16_s_::aggregation_level16_r16_opts::to_string() const
{
  static const char* names[] = {"n1", "n2"};
  return convert_enum_idx(names,
                          2,
                          value,
                          "search_space_ext_r16_s::search_space_type_r16_s_::common_r16_s_::dci_format2_4_r16_s_::nrof_"
                          "candidates_ci_r16_s_::aggregation_level16_r16_e_");
}
uint8_t search_space_ext_r16_s::search_space_type_r16_s_::common_r16_s_::dci_format2_4_r16_s_::
    nrof_candidates_ci_r16_s_::aggregation_level16_r16_opts::to_number() const
{
  static const uint8_t numbers[] = {1, 2};
  return map_enum_number(numbers,
                         2,
                         value,
                         "search_space_ext_r16_s::search_space_type_r16_s_::common_r16_s_::dci_format2_4_r16_s_::nrof_"
                         "candidates_ci_r16_s_::aggregation_level16_r16_e_");
}

const char* search_space_ext_r16_s::search_space_type_r16_s_::common_r16_s_::dci_format2_5_r16_s_::
    nrof_candidates_iab_r16_s_::aggregation_level1_r16_opts::to_string() const
{
  static const char* names[] = {"n1", "n2"};
  return convert_enum_idx(names,
                          2,
                          value,
                          "search_space_ext_r16_s::search_space_type_r16_s_::common_r16_s_::dci_format2_5_r16_s_::nrof_"
                          "candidates_iab_r16_s_::aggregation_level1_r16_e_");
}
uint8_t search_space_ext_r16_s::search_space_type_r16_s_::common_r16_s_::dci_format2_5_r16_s_::
    nrof_candidates_iab_r16_s_::aggregation_level1_r16_opts::to_number() const
{
  static const uint8_t numbers[] = {1, 2};
  return map_enum_number(numbers,
                         2,
                         value,
                         "search_space_ext_r16_s::search_space_type_r16_s_::common_r16_s_::dci_format2_5_r16_s_::nrof_"
                         "candidates_iab_r16_s_::aggregation_level1_r16_e_");
}

const char* search_space_ext_r16_s::search_space_type_r16_s_::common_r16_s_::dci_format2_5_r16_s_::
    nrof_candidates_iab_r16_s_::aggregation_level2_r16_opts::to_string() const
{
  static const char* names[] = {"n1", "n2"};
  return convert_enum_idx(names,
                          2,
                          value,
                          "search_space_ext_r16_s::search_space_type_r16_s_::common_r16_s_::dci_format2_5_r16_s_::nrof_"
                          "candidates_iab_r16_s_::aggregation_level2_r16_e_");
}
uint8_t search_space_ext_r16_s::search_space_type_r16_s_::common_r16_s_::dci_format2_5_r16_s_::
    nrof_candidates_iab_r16_s_::aggregation_level2_r16_opts::to_number() const
{
  static const uint8_t numbers[] = {1, 2};
  return map_enum_number(numbers,
                         2,
                         value,
                         "search_space_ext_r16_s::search_space_type_r16_s_::common_r16_s_::dci_format2_5_r16_s_::nrof_"
                         "candidates_iab_r16_s_::aggregation_level2_r16_e_");
}

const char* search_space_ext_r16_s::search_space_type_r16_s_::common_r16_s_::dci_format2_5_r16_s_::
    nrof_candidates_iab_r16_s_::aggregation_level4_r16_opts::to_string() const
{
  static const char* names[] = {"n1", "n2"};
  return convert_enum_idx(names,
                          2,
                          value,
                          "search_space_ext_r16_s::search_space_type_r16_s_::common_r16_s_::dci_format2_5_r16_s_::nrof_"
                          "candidates_iab_r16_s_::aggregation_level4_r16_e_");
}
uint8_t search_space_ext_r16_s::search_space_type_r16_s_::common_r16_s_::dci_format2_5_r16_s_::
    nrof_candidates_iab_r16_s_::aggregation_level4_r16_opts::to_number() const
{
  static const uint8_t numbers[] = {1, 2};
  return map_enum_number(numbers,
                         2,
                         value,
                         "search_space_ext_r16_s::search_space_type_r16_s_::common_r16_s_::dci_format2_5_r16_s_::nrof_"
                         "candidates_iab_r16_s_::aggregation_level4_r16_e_");
}

const char* search_space_ext_r16_s::search_space_type_r16_s_::common_r16_s_::dci_format2_5_r16_s_::
    nrof_candidates_iab_r16_s_::aggregation_level8_r16_opts::to_string() const
{
  static const char* names[] = {"n1", "n2"};
  return convert_enum_idx(names,
                          2,
                          value,
                          "search_space_ext_r16_s::search_space_type_r16_s_::common_r16_s_::dci_format2_5_r16_s_::nrof_"
                          "candidates_iab_r16_s_::aggregation_level8_r16_e_");
}
uint8_t search_space_ext_r16_s::search_space_type_r16_s_::common_r16_s_::dci_format2_5_r16_s_::
    nrof_candidates_iab_r16_s_::aggregation_level8_r16_opts::to_number() const
{
  static const uint8_t numbers[] = {1, 2};
  return map_enum_number(numbers,
                         2,
                         value,
                         "search_space_ext_r16_s::search_space_type_r16_s_::common_r16_s_::dci_format2_5_r16_s_::nrof_"
                         "candidates_iab_r16_s_::aggregation_level8_r16_e_");
}

const char* search_space_ext_r16_s::search_space_type_r16_s_::common_r16_s_::dci_format2_5_r16_s_::
    nrof_candidates_iab_r16_s_::aggregation_level16_r16_opts::to_string() const
{
  static const char* names[] = {"n1", "n2"};
  return convert_enum_idx(names,
                          2,
                          value,
                          "search_space_ext_r16_s::search_space_type_r16_s_::common_r16_s_::dci_format2_5_r16_s_::nrof_"
                          "candidates_iab_r16_s_::aggregation_level16_r16_e_");
}
uint8_t search_space_ext_r16_s::search_space_type_r16_s_::common_r16_s_::dci_format2_5_r16_s_::
    nrof_candidates_iab_r16_s_::aggregation_level16_r16_opts::to_number() const
{
  static const uint8_t numbers[] = {1, 2};
  return map_enum_number(numbers,
                         2,
                         value,
                         "search_space_ext_r16_s::search_space_type_r16_s_::common_r16_s_::dci_format2_5_r16_s_::nrof_"
                         "candidates_iab_r16_s_::aggregation_level16_r16_e_");
}

// SearchSpaceExt-v1700 ::= SEQUENCE
SRSASN_CODE search_space_ext_v1700_s::pack(bit_ref& bref) const
{
  HANDLE_CODE(bref.pack(monitoring_slot_periodicity_and_offset_v1710_present, 1));
  HANDLE_CODE(bref.pack(monitoring_slots_within_slot_group_r17_present, 1));
  HANDLE_CODE(bref.pack(dur_r17_present, 1));
  HANDLE_CODE(bref.pack(search_space_type_r17_present, 1));
  HANDLE_CODE(bref.pack(search_space_group_id_list_r17.size() > 0, 1));
  HANDLE_CODE(bref.pack(search_space_linking_id_r17_present, 1));

  if (monitoring_slot_periodicity_and_offset_v1710_present) {
    HANDLE_CODE(monitoring_slot_periodicity_and_offset_v1710.pack(bref));
  }
  if (monitoring_slots_within_slot_group_r17_present) {
    HANDLE_CODE(monitoring_slots_within_slot_group_r17.pack(bref));
  }
  if (dur_r17_present) {
    HANDLE_CODE(pack_integer(bref, dur_r17, (uint16_t)4u, (uint16_t)20476u));
  }
  if (search_space_type_r17_present) {
    HANDLE_CODE(bref.pack(search_space_type_r17.common_r17.dci_format4_0_r17_present, 1));
    HANDLE_CODE(bref.pack(search_space_type_r17.common_r17.dci_format4_1_r17_present, 1));
    HANDLE_CODE(bref.pack(search_space_type_r17.common_r17.dci_format4_2_r17_present, 1));
    HANDLE_CODE(bref.pack(search_space_type_r17.common_r17.dci_format4_1_and_format4_2_r17_present, 1));
    HANDLE_CODE(bref.pack(search_space_type_r17.common_r17.dci_format2_7_r17_present, 1));
    if (search_space_type_r17.common_r17.dci_format4_0_r17_present) {
      bref.pack(search_space_type_r17.common_r17.dci_format4_0_r17.ext, 1);
    }
    if (search_space_type_r17.common_r17.dci_format4_1_r17_present) {
      bref.pack(search_space_type_r17.common_r17.dci_format4_1_r17.ext, 1);
    }
    if (search_space_type_r17.common_r17.dci_format4_2_r17_present) {
      bref.pack(search_space_type_r17.common_r17.dci_format4_2_r17.ext, 1);
    }
    if (search_space_type_r17.common_r17.dci_format4_1_and_format4_2_r17_present) {
      bref.pack(search_space_type_r17.common_r17.dci_format4_1_and_format4_2_r17.ext, 1);
    }
    if (search_space_type_r17.common_r17.dci_format2_7_r17_present) {
      bref.pack(search_space_type_r17.common_r17.dci_format2_7_r17.ext, 1);
      HANDLE_CODE(bref.pack(
          search_space_type_r17.common_r17.dci_format2_7_r17.nrof_candidates_pei_r17.aggregation_level4_r17_present,
          1));
      HANDLE_CODE(bref.pack(
          search_space_type_r17.common_r17.dci_format2_7_r17.nrof_candidates_pei_r17.aggregation_level8_r17_present,
          1));
      HANDLE_CODE(bref.pack(
          search_space_type_r17.common_r17.dci_format2_7_r17.nrof_candidates_pei_r17.aggregation_level16_r17_present,
          1));
      if (search_space_type_r17.common_r17.dci_format2_7_r17.nrof_candidates_pei_r17.aggregation_level4_r17_present) {
        HANDLE_CODE(
            search_space_type_r17.common_r17.dci_format2_7_r17.nrof_candidates_pei_r17.aggregation_level4_r17.pack(
                bref));
      }
      if (search_space_type_r17.common_r17.dci_format2_7_r17.nrof_candidates_pei_r17.aggregation_level8_r17_present) {
        HANDLE_CODE(
            search_space_type_r17.common_r17.dci_format2_7_r17.nrof_candidates_pei_r17.aggregation_level8_r17.pack(
                bref));
      }
      if (search_space_type_r17.common_r17.dci_format2_7_r17.nrof_candidates_pei_r17.aggregation_level16_r17_present) {
        HANDLE_CODE(
            search_space_type_r17.common_r17.dci_format2_7_r17.nrof_candidates_pei_r17.aggregation_level16_r17.pack(
                bref));
      }
    }
  }
  if (search_space_group_id_list_r17.size() > 0) {
    HANDLE_CODE(pack_dyn_seq_of(bref, search_space_group_id_list_r17, 1, 3, integer_packer<uint8_t>(0, 2)));
  }
  if (search_space_linking_id_r17_present) {
    HANDLE_CODE(pack_integer(bref, search_space_linking_id_r17, (uint8_t)0u, (uint8_t)39u));
  }

  return SRSASN_SUCCESS;
}
SRSASN_CODE search_space_ext_v1700_s::unpack(cbit_ref& bref)
{
  HANDLE_CODE(bref.unpack(monitoring_slot_periodicity_and_offset_v1710_present, 1));
  HANDLE_CODE(bref.unpack(monitoring_slots_within_slot_group_r17_present, 1));
  HANDLE_CODE(bref.unpack(dur_r17_present, 1));
  HANDLE_CODE(bref.unpack(search_space_type_r17_present, 1));
  bool search_space_group_id_list_r17_present;
  HANDLE_CODE(bref.unpack(search_space_group_id_list_r17_present, 1));
  HANDLE_CODE(bref.unpack(search_space_linking_id_r17_present, 1));

  if (monitoring_slot_periodicity_and_offset_v1710_present) {
    HANDLE_CODE(monitoring_slot_periodicity_and_offset_v1710.unpack(bref));
  }
  if (monitoring_slots_within_slot_group_r17_present) {
    HANDLE_CODE(monitoring_slots_within_slot_group_r17.unpack(bref));
  }
  if (dur_r17_present) {
    HANDLE_CODE(unpack_integer(dur_r17, bref, (uint16_t)4u, (uint16_t)20476u));
  }
  if (search_space_type_r17_present) {
    HANDLE_CODE(bref.unpack(search_space_type_r17.common_r17.dci_format4_0_r17_present, 1));
    HANDLE_CODE(bref.unpack(search_space_type_r17.common_r17.dci_format4_1_r17_present, 1));
    HANDLE_CODE(bref.unpack(search_space_type_r17.common_r17.dci_format4_2_r17_present, 1));
    HANDLE_CODE(bref.unpack(search_space_type_r17.common_r17.dci_format4_1_and_format4_2_r17_present, 1));
    HANDLE_CODE(bref.unpack(search_space_type_r17.common_r17.dci_format2_7_r17_present, 1));
    if (search_space_type_r17.common_r17.dci_format4_0_r17_present) {
      bref.unpack(search_space_type_r17.common_r17.dci_format4_0_r17.ext, 1);
    }
    if (search_space_type_r17.common_r17.dci_format4_1_r17_present) {
      bref.unpack(search_space_type_r17.common_r17.dci_format4_1_r17.ext, 1);
    }
    if (search_space_type_r17.common_r17.dci_format4_2_r17_present) {
      bref.unpack(search_space_type_r17.common_r17.dci_format4_2_r17.ext, 1);
    }
    if (search_space_type_r17.common_r17.dci_format4_1_and_format4_2_r17_present) {
      bref.unpack(search_space_type_r17.common_r17.dci_format4_1_and_format4_2_r17.ext, 1);
    }
    if (search_space_type_r17.common_r17.dci_format2_7_r17_present) {
      bref.unpack(search_space_type_r17.common_r17.dci_format2_7_r17.ext, 1);
      HANDLE_CODE(bref.unpack(
          search_space_type_r17.common_r17.dci_format2_7_r17.nrof_candidates_pei_r17.aggregation_level4_r17_present,
          1));
      HANDLE_CODE(bref.unpack(
          search_space_type_r17.common_r17.dci_format2_7_r17.nrof_candidates_pei_r17.aggregation_level8_r17_present,
          1));
      HANDLE_CODE(bref.unpack(
          search_space_type_r17.common_r17.dci_format2_7_r17.nrof_candidates_pei_r17.aggregation_level16_r17_present,
          1));
      if (search_space_type_r17.common_r17.dci_format2_7_r17.nrof_candidates_pei_r17.aggregation_level4_r17_present) {
        HANDLE_CODE(
            search_space_type_r17.common_r17.dci_format2_7_r17.nrof_candidates_pei_r17.aggregation_level4_r17.unpack(
                bref));
      }
      if (search_space_type_r17.common_r17.dci_format2_7_r17.nrof_candidates_pei_r17.aggregation_level8_r17_present) {
        HANDLE_CODE(
            search_space_type_r17.common_r17.dci_format2_7_r17.nrof_candidates_pei_r17.aggregation_level8_r17.unpack(
                bref));
      }
      if (search_space_type_r17.common_r17.dci_format2_7_r17.nrof_candidates_pei_r17.aggregation_level16_r17_present) {
        HANDLE_CODE(
            search_space_type_r17.common_r17.dci_format2_7_r17.nrof_candidates_pei_r17.aggregation_level16_r17.unpack(
                bref));
      }
    }
  }
  if (search_space_group_id_list_r17_present) {
    HANDLE_CODE(unpack_dyn_seq_of(search_space_group_id_list_r17, bref, 1, 3, integer_packer<uint8_t>(0, 2)));
  }
  if (search_space_linking_id_r17_present) {
    HANDLE_CODE(unpack_integer(search_space_linking_id_r17, bref, (uint8_t)0u, (uint8_t)39u));
  }

  return SRSASN_SUCCESS;
}
void search_space_ext_v1700_s::to_json(json_writer& j) const
{
  j.start_obj();
  if (monitoring_slot_periodicity_and_offset_v1710_present) {
    j.write_fieldname("monitoringSlotPeriodicityAndOffset-v1710");
    monitoring_slot_periodicity_and_offset_v1710.to_json(j);
  }
  if (monitoring_slots_within_slot_group_r17_present) {
    j.write_fieldname("monitoringSlotsWithinSlotGroup-r17");
    monitoring_slots_within_slot_group_r17.to_json(j);
  }
  if (dur_r17_present) {
    j.write_int("duration-r17", dur_r17);
  }
  if (search_space_type_r17_present) {
    j.write_fieldname("searchSpaceType-r17");
    j.start_obj();
    j.write_fieldname("common-r17");
    j.start_obj();
    if (search_space_type_r17.common_r17.dci_format4_0_r17_present) {
      j.write_fieldname("dci-Format4-0-r17");
      j.start_obj();
      j.end_obj();
    }
    if (search_space_type_r17.common_r17.dci_format4_1_r17_present) {
      j.write_fieldname("dci-Format4-1-r17");
      j.start_obj();
      j.end_obj();
    }
    if (search_space_type_r17.common_r17.dci_format4_2_r17_present) {
      j.write_fieldname("dci-Format4-2-r17");
      j.start_obj();
      j.end_obj();
    }
    if (search_space_type_r17.common_r17.dci_format4_1_and_format4_2_r17_present) {
      j.write_fieldname("dci-Format4-1-AndFormat4-2-r17");
      j.start_obj();
      j.end_obj();
    }
    if (search_space_type_r17.common_r17.dci_format2_7_r17_present) {
      j.write_fieldname("dci-Format2-7-r17");
      j.start_obj();
      j.write_fieldname("nrofCandidates-PEI-r17");
      j.start_obj();
      if (search_space_type_r17.common_r17.dci_format2_7_r17.nrof_candidates_pei_r17.aggregation_level4_r17_present) {
        j.write_str("aggregationLevel4-r17",
                    search_space_type_r17.common_r17.dci_format2_7_r17.nrof_candidates_pei_r17.aggregation_level4_r17
                        .to_string());
      }
      if (search_space_type_r17.common_r17.dci_format2_7_r17.nrof_candidates_pei_r17.aggregation_level8_r17_present) {
        j.write_str("aggregationLevel8-r17",
                    search_space_type_r17.common_r17.dci_format2_7_r17.nrof_candidates_pei_r17.aggregation_level8_r17
                        .to_string());
      }
      if (search_space_type_r17.common_r17.dci_format2_7_r17.nrof_candidates_pei_r17.aggregation_level16_r17_present) {
        j.write_str("aggregationLevel16-r17",
                    search_space_type_r17.common_r17.dci_format2_7_r17.nrof_candidates_pei_r17.aggregation_level16_r17
                        .to_string());
      }
      j.end_obj();
      j.end_obj();
    }
    j.end_obj();
    j.end_obj();
  }
  if (search_space_group_id_list_r17.size() > 0) {
    j.start_array("searchSpaceGroupIdList-r17");
    for (const auto& e1 : search_space_group_id_list_r17) {
      j.write_int(e1);
    }
    j.end_array();
  }
  if (search_space_linking_id_r17_present) {
    j.write_int("searchSpaceLinkingId-r17", search_space_linking_id_r17);
  }
  j.end_obj();
}

void search_space_ext_v1700_s::monitoring_slot_periodicity_and_offset_v1710_c_::destroy_() {}
void search_space_ext_v1700_s::monitoring_slot_periodicity_and_offset_v1710_c_::set(types::options e)
{
  destroy_();
  type_ = e;
}
search_space_ext_v1700_s::monitoring_slot_periodicity_and_offset_v1710_c_::
    monitoring_slot_periodicity_and_offset_v1710_c_(
        const search_space_ext_v1700_s::monitoring_slot_periodicity_and_offset_v1710_c_& other)
{
  type_ = other.type();
  switch (type_) {
    case types::sl32:
      c.init(other.c.get<uint8_t>());
      break;
    case types::sl64:
      c.init(other.c.get<uint8_t>());
      break;
    case types::sl128:
      c.init(other.c.get<uint8_t>());
      break;
    case types::sl5120:
      c.init(other.c.get<uint16_t>());
      break;
    case types::sl10240:
      c.init(other.c.get<uint16_t>());
      break;
    case types::sl20480:
      c.init(other.c.get<uint16_t>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "search_space_ext_v1700_s::monitoring_slot_periodicity_and_offset_v1710_c_");
  }
}
search_space_ext_v1700_s::monitoring_slot_periodicity_and_offset_v1710_c_&
search_space_ext_v1700_s::monitoring_slot_periodicity_and_offset_v1710_c_::operator=(
    const search_space_ext_v1700_s::monitoring_slot_periodicity_and_offset_v1710_c_& other)
{
  if (this == &other) {
    return *this;
  }
  set(other.type());
  switch (type_) {
    case types::sl32:
      c.set(other.c.get<uint8_t>());
      break;
    case types::sl64:
      c.set(other.c.get<uint8_t>());
      break;
    case types::sl128:
      c.set(other.c.get<uint8_t>());
      break;
    case types::sl5120:
      c.set(other.c.get<uint16_t>());
      break;
    case types::sl10240:
      c.set(other.c.get<uint16_t>());
      break;
    case types::sl20480:
      c.set(other.c.get<uint16_t>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "search_space_ext_v1700_s::monitoring_slot_periodicity_and_offset_v1710_c_");
  }

  return *this;
}
uint8_t& search_space_ext_v1700_s::monitoring_slot_periodicity_and_offset_v1710_c_::set_sl32()
{
  set(types::sl32);
  return c.get<uint8_t>();
}
uint8_t& search_space_ext_v1700_s::monitoring_slot_periodicity_and_offset_v1710_c_::set_sl64()
{
  set(types::sl64);
  return c.get<uint8_t>();
}
uint8_t& search_space_ext_v1700_s::monitoring_slot_periodicity_and_offset_v1710_c_::set_sl128()
{
  set(types::sl128);
  return c.get<uint8_t>();
}
uint16_t& search_space_ext_v1700_s::monitoring_slot_periodicity_and_offset_v1710_c_::set_sl5120()
{
  set(types::sl5120);
  return c.get<uint16_t>();
}
uint16_t& search_space_ext_v1700_s::monitoring_slot_periodicity_and_offset_v1710_c_::set_sl10240()
{
  set(types::sl10240);
  return c.get<uint16_t>();
}
uint16_t& search_space_ext_v1700_s::monitoring_slot_periodicity_and_offset_v1710_c_::set_sl20480()
{
  set(types::sl20480);
  return c.get<uint16_t>();
}
void search_space_ext_v1700_s::monitoring_slot_periodicity_and_offset_v1710_c_::to_json(json_writer& j) const
{
  j.start_obj();
  switch (type_) {
    case types::sl32:
      j.write_int("sl32", c.get<uint8_t>());
      break;
    case types::sl64:
      j.write_int("sl64", c.get<uint8_t>());
      break;
    case types::sl128:
      j.write_int("sl128", c.get<uint8_t>());
      break;
    case types::sl5120:
      j.write_int("sl5120", c.get<uint16_t>());
      break;
    case types::sl10240:
      j.write_int("sl10240", c.get<uint16_t>());
      break;
    case types::sl20480:
      j.write_int("sl20480", c.get<uint16_t>());
      break;
    default:
      log_invalid_choice_id(type_, "search_space_ext_v1700_s::monitoring_slot_periodicity_and_offset_v1710_c_");
  }
  j.end_obj();
}
SRSASN_CODE search_space_ext_v1700_s::monitoring_slot_periodicity_and_offset_v1710_c_::pack(bit_ref& bref) const
{
  type_.pack(bref);
  switch (type_) {
    case types::sl32:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)31u));
      break;
    case types::sl64:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)63u));
      break;
    case types::sl128:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)127u));
      break;
    case types::sl5120:
      HANDLE_CODE(pack_integer(bref, c.get<uint16_t>(), (uint16_t)0u, (uint16_t)5119u));
      break;
    case types::sl10240:
      HANDLE_CODE(pack_integer(bref, c.get<uint16_t>(), (uint16_t)0u, (uint16_t)10239u));
      break;
    case types::sl20480:
      HANDLE_CODE(pack_integer(bref, c.get<uint16_t>(), (uint16_t)0u, (uint16_t)20479u));
      break;
    default:
      log_invalid_choice_id(type_, "search_space_ext_v1700_s::monitoring_slot_periodicity_and_offset_v1710_c_");
      return SRSASN_ERROR_ENCODE_FAIL;
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE search_space_ext_v1700_s::monitoring_slot_periodicity_and_offset_v1710_c_::unpack(cbit_ref& bref)
{
  types e;
  e.unpack(bref);
  set(e);
  switch (type_) {
    case types::sl32:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)31u));
      break;
    case types::sl64:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)63u));
      break;
    case types::sl128:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)127u));
      break;
    case types::sl5120:
      HANDLE_CODE(unpack_integer(c.get<uint16_t>(), bref, (uint16_t)0u, (uint16_t)5119u));
      break;
    case types::sl10240:
      HANDLE_CODE(unpack_integer(c.get<uint16_t>(), bref, (uint16_t)0u, (uint16_t)10239u));
      break;
    case types::sl20480:
      HANDLE_CODE(unpack_integer(c.get<uint16_t>(), bref, (uint16_t)0u, (uint16_t)20479u));
      break;
    default:
      log_invalid_choice_id(type_, "search_space_ext_v1700_s::monitoring_slot_periodicity_and_offset_v1710_c_");
      return SRSASN_ERROR_DECODE_FAIL;
  }
  return SRSASN_SUCCESS;
}

const char* search_space_ext_v1700_s::monitoring_slot_periodicity_and_offset_v1710_c_::types_opts::to_string() const
{
  static const char* names[] = {"sl32", "sl64", "sl128", "sl5120", "sl10240", "sl20480"};
  return convert_enum_idx(
      names, 6, value, "search_space_ext_v1700_s::monitoring_slot_periodicity_and_offset_v1710_c_::types");
}
uint16_t search_space_ext_v1700_s::monitoring_slot_periodicity_and_offset_v1710_c_::types_opts::to_number() const
{
  static const uint16_t numbers[] = {32, 64, 128, 5120, 10240, 20480};
  return map_enum_number(
      numbers, 6, value, "search_space_ext_v1700_s::monitoring_slot_periodicity_and_offset_v1710_c_::types");
}

void search_space_ext_v1700_s::monitoring_slots_within_slot_group_r17_c_::destroy_()
{
  switch (type_) {
    case types::slot_group_len4_r17:
      c.destroy<fixed_bitstring<4>>();
      break;
    case types::slot_group_len8_r17:
      c.destroy<fixed_bitstring<8>>();
      break;
    default:
      break;
  }
}
void search_space_ext_v1700_s::monitoring_slots_within_slot_group_r17_c_::set(types::options e)
{
  destroy_();
  type_ = e;
  switch (type_) {
    case types::slot_group_len4_r17:
      c.init<fixed_bitstring<4>>();
      break;
    case types::slot_group_len8_r17:
      c.init<fixed_bitstring<8>>();
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "search_space_ext_v1700_s::monitoring_slots_within_slot_group_r17_c_");
  }
}
search_space_ext_v1700_s::monitoring_slots_within_slot_group_r17_c_::monitoring_slots_within_slot_group_r17_c_(
    const search_space_ext_v1700_s::monitoring_slots_within_slot_group_r17_c_& other)
{
  type_ = other.type();
  switch (type_) {
    case types::slot_group_len4_r17:
      c.init(other.c.get<fixed_bitstring<4>>());
      break;
    case types::slot_group_len8_r17:
      c.init(other.c.get<fixed_bitstring<8>>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "search_space_ext_v1700_s::monitoring_slots_within_slot_group_r17_c_");
  }
}
search_space_ext_v1700_s::monitoring_slots_within_slot_group_r17_c_&
search_space_ext_v1700_s::monitoring_slots_within_slot_group_r17_c_::operator=(
    const search_space_ext_v1700_s::monitoring_slots_within_slot_group_r17_c_& other)
{
  if (this == &other) {
    return *this;
  }
  set(other.type());
  switch (type_) {
    case types::slot_group_len4_r17:
      c.set(other.c.get<fixed_bitstring<4>>());
      break;
    case types::slot_group_len8_r17:
      c.set(other.c.get<fixed_bitstring<8>>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "search_space_ext_v1700_s::monitoring_slots_within_slot_group_r17_c_");
  }

  return *this;
}
fixed_bitstring<4>& search_space_ext_v1700_s::monitoring_slots_within_slot_group_r17_c_::set_slot_group_len4_r17()
{
  set(types::slot_group_len4_r17);
  return c.get<fixed_bitstring<4>>();
}
fixed_bitstring<8>& search_space_ext_v1700_s::monitoring_slots_within_slot_group_r17_c_::set_slot_group_len8_r17()
{
  set(types::slot_group_len8_r17);
  return c.get<fixed_bitstring<8>>();
}
void search_space_ext_v1700_s::monitoring_slots_within_slot_group_r17_c_::to_json(json_writer& j) const
{
  j.start_obj();
  switch (type_) {
    case types::slot_group_len4_r17:
      j.write_str("slotGroupLength4-r17", c.get<fixed_bitstring<4>>().to_string());
      break;
    case types::slot_group_len8_r17:
      j.write_str("slotGroupLength8-r17", c.get<fixed_bitstring<8>>().to_string());
      break;
    default:
      log_invalid_choice_id(type_, "search_space_ext_v1700_s::monitoring_slots_within_slot_group_r17_c_");
  }
  j.end_obj();
}
SRSASN_CODE search_space_ext_v1700_s::monitoring_slots_within_slot_group_r17_c_::pack(bit_ref& bref) const
{
  type_.pack(bref);
  switch (type_) {
    case types::slot_group_len4_r17:
      HANDLE_CODE(c.get<fixed_bitstring<4>>().pack(bref));
      break;
    case types::slot_group_len8_r17:
      HANDLE_CODE(c.get<fixed_bitstring<8>>().pack(bref));
      break;
    default:
      log_invalid_choice_id(type_, "search_space_ext_v1700_s::monitoring_slots_within_slot_group_r17_c_");
      return SRSASN_ERROR_ENCODE_FAIL;
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE search_space_ext_v1700_s::monitoring_slots_within_slot_group_r17_c_::unpack(cbit_ref& bref)
{
  types e;
  e.unpack(bref);
  set(e);
  switch (type_) {
    case types::slot_group_len4_r17:
      HANDLE_CODE(c.get<fixed_bitstring<4>>().unpack(bref));
      break;
    case types::slot_group_len8_r17:
      HANDLE_CODE(c.get<fixed_bitstring<8>>().unpack(bref));
      break;
    default:
      log_invalid_choice_id(type_, "search_space_ext_v1700_s::monitoring_slots_within_slot_group_r17_c_");
      return SRSASN_ERROR_DECODE_FAIL;
  }
  return SRSASN_SUCCESS;
}

const char* search_space_ext_v1700_s::monitoring_slots_within_slot_group_r17_c_::types_opts::to_string() const
{
  static const char* names[] = {"slotGroupLength4-r17", "slotGroupLength8-r17"};
  return convert_enum_idx(
      names, 2, value, "search_space_ext_v1700_s::monitoring_slots_within_slot_group_r17_c_::types");
}
uint8_t search_space_ext_v1700_s::monitoring_slots_within_slot_group_r17_c_::types_opts::to_number() const
{
  static const uint8_t numbers[] = {4, 8};
  return map_enum_number(
      numbers, 2, value, "search_space_ext_v1700_s::monitoring_slots_within_slot_group_r17_c_::types");
}

const char* search_space_ext_v1700_s::search_space_type_r17_s_::common_r17_s_::dci_format2_7_r17_s_::
    nrof_candidates_pei_r17_s_::aggregation_level4_r17_opts::to_string() const
{
  static const char* names[] = {"n0", "n1", "n2", "n3", "n4"};
  return convert_enum_idx(names,
                          5,
                          value,
                          "search_space_ext_v1700_s::search_space_type_r17_s_::common_r17_s_::dci_format2_7_r17_s_::"
                          "nrof_candidates_pei_r17_s_::aggregation_level4_r17_e_");
}
uint8_t search_space_ext_v1700_s::search_space_type_r17_s_::common_r17_s_::dci_format2_7_r17_s_::
    nrof_candidates_pei_r17_s_::aggregation_level4_r17_opts::to_number() const
{
  static const uint8_t numbers[] = {0, 1, 2, 3, 4};
  return map_enum_number(numbers,
                         5,
                         value,
                         "search_space_ext_v1700_s::search_space_type_r17_s_::common_r17_s_::dci_format2_7_r17_s_::"
                         "nrof_candidates_pei_r17_s_::aggregation_level4_r17_e_");
}

const char* search_space_ext_v1700_s::search_space_type_r17_s_::common_r17_s_::dci_format2_7_r17_s_::
    nrof_candidates_pei_r17_s_::aggregation_level8_r17_opts::to_string() const
{
  static const char* names[] = {"n0", "n1", "n2"};
  return convert_enum_idx(names,
                          3,
                          value,
                          "search_space_ext_v1700_s::search_space_type_r17_s_::common_r17_s_::dci_format2_7_r17_s_::"
                          "nrof_candidates_pei_r17_s_::aggregation_level8_r17_e_");
}
uint8_t search_space_ext_v1700_s::search_space_type_r17_s_::common_r17_s_::dci_format2_7_r17_s_::
    nrof_candidates_pei_r17_s_::aggregation_level8_r17_opts::to_number() const
{
  static const uint8_t numbers[] = {0, 1, 2};
  return map_enum_number(numbers,
                         3,
                         value,
                         "search_space_ext_v1700_s::search_space_type_r17_s_::common_r17_s_::dci_format2_7_r17_s_::"
                         "nrof_candidates_pei_r17_s_::aggregation_level8_r17_e_");
}

const char* search_space_ext_v1700_s::search_space_type_r17_s_::common_r17_s_::dci_format2_7_r17_s_::
    nrof_candidates_pei_r17_s_::aggregation_level16_r17_opts::to_string() const
{
  static const char* names[] = {"n0", "n1"};
  return convert_enum_idx(names,
                          2,
                          value,
                          "search_space_ext_v1700_s::search_space_type_r17_s_::common_r17_s_::dci_format2_7_r17_s_::"
                          "nrof_candidates_pei_r17_s_::aggregation_level16_r17_e_");
}
uint8_t search_space_ext_v1700_s::search_space_type_r17_s_::common_r17_s_::dci_format2_7_r17_s_::
    nrof_candidates_pei_r17_s_::aggregation_level16_r17_opts::to_number() const
{
  static const uint8_t numbers[] = {0, 1};
  return map_enum_number(numbers,
                         2,
                         value,
                         "search_space_ext_v1700_s::search_space_type_r17_s_::common_r17_s_::dci_format2_7_r17_s_::"
                         "nrof_candidates_pei_r17_s_::aggregation_level16_r17_e_");
}

// BWP ::= SEQUENCE
SRSASN_CODE bwp_s::pack(bit_ref& bref) const
{
  HANDLE_CODE(bref.pack(cp_present, 1));

  HANDLE_CODE(pack_integer(bref, location_and_bw, (uint16_t)0u, (uint16_t)37949u));
  HANDLE_CODE(subcarrier_spacing.pack(bref));

  return SRSASN_SUCCESS;
}
SRSASN_CODE bwp_s::unpack(cbit_ref& bref)
{
  HANDLE_CODE(bref.unpack(cp_present, 1));

  HANDLE_CODE(unpack_integer(location_and_bw, bref, (uint16_t)0u, (uint16_t)37949u));
  HANDLE_CODE(subcarrier_spacing.unpack(bref));

  return SRSASN_SUCCESS;
}
void bwp_s::to_json(json_writer& j) const
{
  j.start_obj();
  j.write_int("locationAndBandwidth", location_and_bw);
  j.write_str("subcarrierSpacing", subcarrier_spacing.to_string());
  if (cp_present) {
    j.write_str("cyclicPrefix", "extended");
  }
  j.end_obj();
}

// NumberOfMsg3-Repetitions-r17 ::= ENUMERATED
const char* nof_msg3_repeats_r17_opts::to_string() const
{
  static const char* names[] = {"n1", "n2", "n3", "n4", "n7", "n8", "n12", "n16"};
  return convert_enum_idx(names, 8, value, "nof_msg3_repeats_r17_e");
}
uint8_t nof_msg3_repeats_r17_opts::to_number() const
{
  static const uint8_t numbers[] = {1, 2, 3, 4, 7, 8, 12, 16};
  return map_enum_number(numbers, 8, value, "nof_msg3_repeats_r17_e");
}

// PDCCH-ConfigCommon ::= SEQUENCE
SRSASN_CODE pdcch_cfg_common_s::pack(bit_ref& bref) const
{
  bref.pack(ext, 1);
  HANDLE_CODE(bref.pack(coreset_zero_present, 1));
  HANDLE_CODE(bref.pack(common_coreset_present, 1));
  HANDLE_CODE(bref.pack(search_space_zero_present, 1));
  HANDLE_CODE(bref.pack(common_search_space_list.size() > 0, 1));
  HANDLE_CODE(bref.pack(search_space_sib1_present, 1));
  HANDLE_CODE(bref.pack(search_space_other_sys_info_present, 1));
  HANDLE_CODE(bref.pack(paging_search_space_present, 1));
  HANDLE_CODE(bref.pack(ra_search_space_present, 1));

  if (coreset_zero_present) {
    HANDLE_CODE(pack_integer(bref, coreset_zero, (uint8_t)0u, (uint8_t)15u));
  }
  if (common_coreset_present) {
    HANDLE_CODE(common_coreset.pack(bref));
  }
  if (search_space_zero_present) {
    HANDLE_CODE(pack_integer(bref, search_space_zero, (uint8_t)0u, (uint8_t)15u));
  }
  if (common_search_space_list.size() > 0) {
    HANDLE_CODE(pack_dyn_seq_of(bref, common_search_space_list, 1, 4));
  }
  if (search_space_sib1_present) {
    HANDLE_CODE(pack_integer(bref, search_space_sib1, (uint8_t)0u, (uint8_t)39u));
  }
  if (search_space_other_sys_info_present) {
    HANDLE_CODE(pack_integer(bref, search_space_other_sys_info, (uint8_t)0u, (uint8_t)39u));
  }
  if (paging_search_space_present) {
    HANDLE_CODE(pack_integer(bref, paging_search_space, (uint8_t)0u, (uint8_t)39u));
  }
  if (ra_search_space_present) {
    HANDLE_CODE(pack_integer(bref, ra_search_space, (uint8_t)0u, (uint8_t)39u));
  }

  if (ext) {
    ext_groups_packer_guard group_flags;
    group_flags[0] |= first_pdcch_monitoring_occasion_of_po.is_present();
    group_flags[1] |= common_search_space_list_ext_r16.is_present();
    group_flags[2] |= sdt_search_space_r17.is_present();
    group_flags[2] |= search_space_mcch_r17_present;
    group_flags[2] |= search_space_mtch_r17_present;
    group_flags[2] |= common_search_space_list_ext2_r17.is_present();
    group_flags[2] |= first_pdcch_monitoring_occasion_of_po_v1710.is_present();
    group_flags[2] |= pei_cfg_bwp_r17.is_present();
    group_flags[3] |= follow_unified_tci_state_v1720_present;
    group_flags.pack(bref);

    if (group_flags[0]) {
      varlength_field_pack_guard varlen_scope(bref, false);

      HANDLE_CODE(bref.pack(first_pdcch_monitoring_occasion_of_po.is_present(), 1));
      if (first_pdcch_monitoring_occasion_of_po.is_present()) {
        HANDLE_CODE(first_pdcch_monitoring_occasion_of_po->pack(bref));
      }
    }
    if (group_flags[1]) {
      varlength_field_pack_guard varlen_scope(bref, false);

      HANDLE_CODE(bref.pack(common_search_space_list_ext_r16.is_present(), 1));
      if (common_search_space_list_ext_r16.is_present()) {
        HANDLE_CODE(pack_dyn_seq_of(bref, *common_search_space_list_ext_r16, 1, 4));
      }
    }
    if (group_flags[2]) {
      varlength_field_pack_guard varlen_scope(bref, false);

      HANDLE_CODE(bref.pack(sdt_search_space_r17.is_present(), 1));
      HANDLE_CODE(bref.pack(search_space_mcch_r17_present, 1));
      HANDLE_CODE(bref.pack(search_space_mtch_r17_present, 1));
      HANDLE_CODE(bref.pack(common_search_space_list_ext2_r17.is_present(), 1));
      HANDLE_CODE(bref.pack(first_pdcch_monitoring_occasion_of_po_v1710.is_present(), 1));
      HANDLE_CODE(bref.pack(pei_cfg_bwp_r17.is_present(), 1));
      if (sdt_search_space_r17.is_present()) {
        HANDLE_CODE(sdt_search_space_r17->pack(bref));
      }
      if (search_space_mcch_r17_present) {
        HANDLE_CODE(pack_integer(bref, search_space_mcch_r17, (uint8_t)0u, (uint8_t)39u));
      }
      if (search_space_mtch_r17_present) {
        HANDLE_CODE(pack_integer(bref, search_space_mtch_r17, (uint8_t)0u, (uint8_t)39u));
      }
      if (common_search_space_list_ext2_r17.is_present()) {
        HANDLE_CODE(pack_dyn_seq_of(bref, *common_search_space_list_ext2_r17, 1, 4));
      }
      if (first_pdcch_monitoring_occasion_of_po_v1710.is_present()) {
        HANDLE_CODE(first_pdcch_monitoring_occasion_of_po_v1710->pack(bref));
      }
      if (pei_cfg_bwp_r17.is_present()) {
        HANDLE_CODE(pack_integer(bref, pei_cfg_bwp_r17->pei_search_space_r17, (uint8_t)0u, (uint8_t)39u));
        HANDLE_CODE(pei_cfg_bwp_r17->first_pdcch_monitoring_occasion_of_pei_o_r17.pack(bref));
      }
    }
    if (group_flags[3]) {
      varlength_field_pack_guard varlen_scope(bref, false);

      HANDLE_CODE(bref.pack(follow_unified_tci_state_v1720_present, 1));
    }
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE pdcch_cfg_common_s::unpack(cbit_ref& bref)
{
  bref.unpack(ext, 1);
  HANDLE_CODE(bref.unpack(coreset_zero_present, 1));
  HANDLE_CODE(bref.unpack(common_coreset_present, 1));
  HANDLE_CODE(bref.unpack(search_space_zero_present, 1));
  bool common_search_space_list_present;
  HANDLE_CODE(bref.unpack(common_search_space_list_present, 1));
  HANDLE_CODE(bref.unpack(search_space_sib1_present, 1));
  HANDLE_CODE(bref.unpack(search_space_other_sys_info_present, 1));
  HANDLE_CODE(bref.unpack(paging_search_space_present, 1));
  HANDLE_CODE(bref.unpack(ra_search_space_present, 1));

  if (coreset_zero_present) {
    HANDLE_CODE(unpack_integer(coreset_zero, bref, (uint8_t)0u, (uint8_t)15u));
  }
  if (common_coreset_present) {
    HANDLE_CODE(common_coreset.unpack(bref));
  }
  if (search_space_zero_present) {
    HANDLE_CODE(unpack_integer(search_space_zero, bref, (uint8_t)0u, (uint8_t)15u));
  }
  if (common_search_space_list_present) {
    HANDLE_CODE(unpack_dyn_seq_of(common_search_space_list, bref, 1, 4));
  }
  if (search_space_sib1_present) {
    HANDLE_CODE(unpack_integer(search_space_sib1, bref, (uint8_t)0u, (uint8_t)39u));
  }
  if (search_space_other_sys_info_present) {
    HANDLE_CODE(unpack_integer(search_space_other_sys_info, bref, (uint8_t)0u, (uint8_t)39u));
  }
  if (paging_search_space_present) {
    HANDLE_CODE(unpack_integer(paging_search_space, bref, (uint8_t)0u, (uint8_t)39u));
  }
  if (ra_search_space_present) {
    HANDLE_CODE(unpack_integer(ra_search_space, bref, (uint8_t)0u, (uint8_t)39u));
  }

  if (ext) {
    ext_groups_unpacker_guard group_flags(4);
    group_flags.unpack(bref);

    if (group_flags[0]) {
      varlength_field_unpack_guard varlen_scope(bref, false);

      unpack_presence_flag(first_pdcch_monitoring_occasion_of_po, bref);
      if (first_pdcch_monitoring_occasion_of_po.is_present()) {
        HANDLE_CODE(first_pdcch_monitoring_occasion_of_po->unpack(bref));
      }
    }
    if (group_flags[1]) {
      varlength_field_unpack_guard varlen_scope(bref, false);

      unpack_presence_flag(common_search_space_list_ext_r16, bref);
      if (common_search_space_list_ext_r16.is_present()) {
        HANDLE_CODE(unpack_dyn_seq_of(*common_search_space_list_ext_r16, bref, 1, 4));
      }
    }
    if (group_flags[2]) {
      varlength_field_unpack_guard varlen_scope(bref, false);

      unpack_presence_flag(sdt_search_space_r17, bref);
      HANDLE_CODE(bref.unpack(search_space_mcch_r17_present, 1));
      HANDLE_CODE(bref.unpack(search_space_mtch_r17_present, 1));
      unpack_presence_flag(common_search_space_list_ext2_r17, bref);
      unpack_presence_flag(first_pdcch_monitoring_occasion_of_po_v1710, bref);
      unpack_presence_flag(pei_cfg_bwp_r17, bref);
      if (sdt_search_space_r17.is_present()) {
        HANDLE_CODE(sdt_search_space_r17->unpack(bref));
      }
      if (search_space_mcch_r17_present) {
        HANDLE_CODE(unpack_integer(search_space_mcch_r17, bref, (uint8_t)0u, (uint8_t)39u));
      }
      if (search_space_mtch_r17_present) {
        HANDLE_CODE(unpack_integer(search_space_mtch_r17, bref, (uint8_t)0u, (uint8_t)39u));
      }
      if (common_search_space_list_ext2_r17.is_present()) {
        HANDLE_CODE(unpack_dyn_seq_of(*common_search_space_list_ext2_r17, bref, 1, 4));
      }
      if (first_pdcch_monitoring_occasion_of_po_v1710.is_present()) {
        HANDLE_CODE(first_pdcch_monitoring_occasion_of_po_v1710->unpack(bref));
      }
      if (pei_cfg_bwp_r17.is_present()) {
        HANDLE_CODE(unpack_integer(pei_cfg_bwp_r17->pei_search_space_r17, bref, (uint8_t)0u, (uint8_t)39u));
        HANDLE_CODE(pei_cfg_bwp_r17->first_pdcch_monitoring_occasion_of_pei_o_r17.unpack(bref));
      }
    }
    if (group_flags[3]) {
      varlength_field_unpack_guard varlen_scope(bref, false);

      HANDLE_CODE(bref.unpack(follow_unified_tci_state_v1720_present, 1));
    }
  }
  return SRSASN_SUCCESS;
}
void pdcch_cfg_common_s::to_json(json_writer& j) const
{
  j.start_obj();
  if (coreset_zero_present) {
    j.write_int("controlResourceSetZero", coreset_zero);
  }
  if (common_coreset_present) {
    j.write_fieldname("commonControlResourceSet");
    common_coreset.to_json(j);
  }
  if (search_space_zero_present) {
    j.write_int("searchSpaceZero", search_space_zero);
  }
  if (common_search_space_list.size() > 0) {
    j.start_array("commonSearchSpaceList");
    for (const auto& e1 : common_search_space_list) {
      e1.to_json(j);
    }
    j.end_array();
  }
  if (search_space_sib1_present) {
    j.write_int("searchSpaceSIB1", search_space_sib1);
  }
  if (search_space_other_sys_info_present) {
    j.write_int("searchSpaceOtherSystemInformation", search_space_other_sys_info);
  }
  if (paging_search_space_present) {
    j.write_int("pagingSearchSpace", paging_search_space);
  }
  if (ra_search_space_present) {
    j.write_int("ra-SearchSpace", ra_search_space);
  }
  if (ext) {
    if (first_pdcch_monitoring_occasion_of_po.is_present()) {
      j.write_fieldname("firstPDCCH-MonitoringOccasionOfPO");
      first_pdcch_monitoring_occasion_of_po->to_json(j);
    }
    if (common_search_space_list_ext_r16.is_present()) {
      j.start_array("commonSearchSpaceListExt-r16");
      for (const auto& e1 : *common_search_space_list_ext_r16) {
        e1.to_json(j);
      }
      j.end_array();
    }
    if (sdt_search_space_r17.is_present()) {
      j.write_fieldname("sdt-SearchSpace-r17");
      sdt_search_space_r17->to_json(j);
    }
    if (search_space_mcch_r17_present) {
      j.write_int("searchSpaceMCCH-r17", search_space_mcch_r17);
    }
    if (search_space_mtch_r17_present) {
      j.write_int("searchSpaceMTCH-r17", search_space_mtch_r17);
    }
    if (common_search_space_list_ext2_r17.is_present()) {
      j.start_array("commonSearchSpaceListExt2-r17");
      for (const auto& e1 : *common_search_space_list_ext2_r17) {
        e1.to_json(j);
      }
      j.end_array();
    }
    if (first_pdcch_monitoring_occasion_of_po_v1710.is_present()) {
      j.write_fieldname("firstPDCCH-MonitoringOccasionOfPO-v1710");
      first_pdcch_monitoring_occasion_of_po_v1710->to_json(j);
    }
    if (pei_cfg_bwp_r17.is_present()) {
      j.write_fieldname("pei-ConfigBWP-r17");
      j.start_obj();
      j.write_int("pei-SearchSpace-r17", pei_cfg_bwp_r17->pei_search_space_r17);
      j.write_fieldname("firstPDCCH-MonitoringOccasionOfPEI-O-r17");
      pei_cfg_bwp_r17->first_pdcch_monitoring_occasion_of_pei_o_r17.to_json(j);
      j.end_obj();
    }
    if (follow_unified_tci_state_v1720_present) {
      j.write_str("followUnifiedTCI-State-v1720", "enabled");
    }
  }
  j.end_obj();
}

void pdcch_cfg_common_s::first_pdcch_monitoring_occasion_of_po_c_::destroy_()
{
  switch (type_) {
    case types::scs15_kh_zone_t:
      c.destroy<scs15_kh_zone_t_l_>();
      break;
    case types::scs30_kh_zone_t_scs15_kh_zhalf_t:
      c.destroy<scs30_kh_zone_t_scs15_kh_zhalf_t_l_>();
      break;
    case types::scs60_kh_zone_t_scs30_kh_zhalf_t_scs15_kh_zquarter_t:
      c.destroy<scs60_kh_zone_t_scs30_kh_zhalf_t_scs15_kh_zquarter_t_l_>();
      break;
    case types::scs120_kh_zone_t_scs60_kh_zhalf_t_scs30_kh_zquarter_t_scs15_kh_zone_eighth_t:
      c.destroy<scs120_kh_zone_t_scs60_kh_zhalf_t_scs30_kh_zquarter_t_scs15_kh_zone_eighth_t_l_>();
      break;
    case types::scs120_kh_zhalf_t_scs60_kh_zquarter_t_scs30_kh_zone_eighth_t_scs15_kh_zone_sixteenth_t:
      c.destroy<scs120_kh_zhalf_t_scs60_kh_zquarter_t_scs30_kh_zone_eighth_t_scs15_kh_zone_sixteenth_t_l_>();
      break;
    case types::scs120_kh_zquarter_t_scs60_kh_zone_eighth_t_scs30_kh_zone_sixteenth_t:
      c.destroy<scs120_kh_zquarter_t_scs60_kh_zone_eighth_t_scs30_kh_zone_sixteenth_t_l_>();
      break;
    case types::scs120_kh_zone_eighth_t_scs60_kh_zone_sixteenth_t:
      c.destroy<scs120_kh_zone_eighth_t_scs60_kh_zone_sixteenth_t_l_>();
      break;
    case types::scs120_kh_zone_sixteenth_t:
      c.destroy<scs120_kh_zone_sixteenth_t_l_>();
      break;
    default:
      break;
  }
}
void pdcch_cfg_common_s::first_pdcch_monitoring_occasion_of_po_c_::set(types::options e)
{
  destroy_();
  type_ = e;
  switch (type_) {
    case types::scs15_kh_zone_t:
      c.init<scs15_kh_zone_t_l_>();
      break;
    case types::scs30_kh_zone_t_scs15_kh_zhalf_t:
      c.init<scs30_kh_zone_t_scs15_kh_zhalf_t_l_>();
      break;
    case types::scs60_kh_zone_t_scs30_kh_zhalf_t_scs15_kh_zquarter_t:
      c.init<scs60_kh_zone_t_scs30_kh_zhalf_t_scs15_kh_zquarter_t_l_>();
      break;
    case types::scs120_kh_zone_t_scs60_kh_zhalf_t_scs30_kh_zquarter_t_scs15_kh_zone_eighth_t:
      c.init<scs120_kh_zone_t_scs60_kh_zhalf_t_scs30_kh_zquarter_t_scs15_kh_zone_eighth_t_l_>();
      break;
    case types::scs120_kh_zhalf_t_scs60_kh_zquarter_t_scs30_kh_zone_eighth_t_scs15_kh_zone_sixteenth_t:
      c.init<scs120_kh_zhalf_t_scs60_kh_zquarter_t_scs30_kh_zone_eighth_t_scs15_kh_zone_sixteenth_t_l_>();
      break;
    case types::scs120_kh_zquarter_t_scs60_kh_zone_eighth_t_scs30_kh_zone_sixteenth_t:
      c.init<scs120_kh_zquarter_t_scs60_kh_zone_eighth_t_scs30_kh_zone_sixteenth_t_l_>();
      break;
    case types::scs120_kh_zone_eighth_t_scs60_kh_zone_sixteenth_t:
      c.init<scs120_kh_zone_eighth_t_scs60_kh_zone_sixteenth_t_l_>();
      break;
    case types::scs120_kh_zone_sixteenth_t:
      c.init<scs120_kh_zone_sixteenth_t_l_>();
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "pdcch_cfg_common_s::first_pdcch_monitoring_occasion_of_po_c_");
  }
}
pdcch_cfg_common_s::first_pdcch_monitoring_occasion_of_po_c_::first_pdcch_monitoring_occasion_of_po_c_(
    const pdcch_cfg_common_s::first_pdcch_monitoring_occasion_of_po_c_& other)
{
  type_ = other.type();
  switch (type_) {
    case types::scs15_kh_zone_t:
      c.init(other.c.get<scs15_kh_zone_t_l_>());
      break;
    case types::scs30_kh_zone_t_scs15_kh_zhalf_t:
      c.init(other.c.get<scs30_kh_zone_t_scs15_kh_zhalf_t_l_>());
      break;
    case types::scs60_kh_zone_t_scs30_kh_zhalf_t_scs15_kh_zquarter_t:
      c.init(other.c.get<scs60_kh_zone_t_scs30_kh_zhalf_t_scs15_kh_zquarter_t_l_>());
      break;
    case types::scs120_kh_zone_t_scs60_kh_zhalf_t_scs30_kh_zquarter_t_scs15_kh_zone_eighth_t:
      c.init(other.c.get<scs120_kh_zone_t_scs60_kh_zhalf_t_scs30_kh_zquarter_t_scs15_kh_zone_eighth_t_l_>());
      break;
    case types::scs120_kh_zhalf_t_scs60_kh_zquarter_t_scs30_kh_zone_eighth_t_scs15_kh_zone_sixteenth_t:
      c.init(other.c.get<scs120_kh_zhalf_t_scs60_kh_zquarter_t_scs30_kh_zone_eighth_t_scs15_kh_zone_sixteenth_t_l_>());
      break;
    case types::scs120_kh_zquarter_t_scs60_kh_zone_eighth_t_scs30_kh_zone_sixteenth_t:
      c.init(other.c.get<scs120_kh_zquarter_t_scs60_kh_zone_eighth_t_scs30_kh_zone_sixteenth_t_l_>());
      break;
    case types::scs120_kh_zone_eighth_t_scs60_kh_zone_sixteenth_t:
      c.init(other.c.get<scs120_kh_zone_eighth_t_scs60_kh_zone_sixteenth_t_l_>());
      break;
    case types::scs120_kh_zone_sixteenth_t:
      c.init(other.c.get<scs120_kh_zone_sixteenth_t_l_>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "pdcch_cfg_common_s::first_pdcch_monitoring_occasion_of_po_c_");
  }
}
pdcch_cfg_common_s::first_pdcch_monitoring_occasion_of_po_c_&
pdcch_cfg_common_s::first_pdcch_monitoring_occasion_of_po_c_::operator=(
    const pdcch_cfg_common_s::first_pdcch_monitoring_occasion_of_po_c_& other)
{
  if (this == &other) {
    return *this;
  }
  set(other.type());
  switch (type_) {
    case types::scs15_kh_zone_t:
      c.set(other.c.get<scs15_kh_zone_t_l_>());
      break;
    case types::scs30_kh_zone_t_scs15_kh_zhalf_t:
      c.set(other.c.get<scs30_kh_zone_t_scs15_kh_zhalf_t_l_>());
      break;
    case types::scs60_kh_zone_t_scs30_kh_zhalf_t_scs15_kh_zquarter_t:
      c.set(other.c.get<scs60_kh_zone_t_scs30_kh_zhalf_t_scs15_kh_zquarter_t_l_>());
      break;
    case types::scs120_kh_zone_t_scs60_kh_zhalf_t_scs30_kh_zquarter_t_scs15_kh_zone_eighth_t:
      c.set(other.c.get<scs120_kh_zone_t_scs60_kh_zhalf_t_scs30_kh_zquarter_t_scs15_kh_zone_eighth_t_l_>());
      break;
    case types::scs120_kh_zhalf_t_scs60_kh_zquarter_t_scs30_kh_zone_eighth_t_scs15_kh_zone_sixteenth_t:
      c.set(other.c.get<scs120_kh_zhalf_t_scs60_kh_zquarter_t_scs30_kh_zone_eighth_t_scs15_kh_zone_sixteenth_t_l_>());
      break;
    case types::scs120_kh_zquarter_t_scs60_kh_zone_eighth_t_scs30_kh_zone_sixteenth_t:
      c.set(other.c.get<scs120_kh_zquarter_t_scs60_kh_zone_eighth_t_scs30_kh_zone_sixteenth_t_l_>());
      break;
    case types::scs120_kh_zone_eighth_t_scs60_kh_zone_sixteenth_t:
      c.set(other.c.get<scs120_kh_zone_eighth_t_scs60_kh_zone_sixteenth_t_l_>());
      break;
    case types::scs120_kh_zone_sixteenth_t:
      c.set(other.c.get<scs120_kh_zone_sixteenth_t_l_>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "pdcch_cfg_common_s::first_pdcch_monitoring_occasion_of_po_c_");
  }

  return *this;
}
pdcch_cfg_common_s::first_pdcch_monitoring_occasion_of_po_c_::scs15_kh_zone_t_l_&
pdcch_cfg_common_s::first_pdcch_monitoring_occasion_of_po_c_::set_scs15_kh_zone_t()
{
  set(types::scs15_kh_zone_t);
  return c.get<scs15_kh_zone_t_l_>();
}
pdcch_cfg_common_s::first_pdcch_monitoring_occasion_of_po_c_::scs30_kh_zone_t_scs15_kh_zhalf_t_l_&
pdcch_cfg_common_s::first_pdcch_monitoring_occasion_of_po_c_::set_scs30_kh_zone_t_scs15_kh_zhalf_t()
{
  set(types::scs30_kh_zone_t_scs15_kh_zhalf_t);
  return c.get<scs30_kh_zone_t_scs15_kh_zhalf_t_l_>();
}
pdcch_cfg_common_s::first_pdcch_monitoring_occasion_of_po_c_::scs60_kh_zone_t_scs30_kh_zhalf_t_scs15_kh_zquarter_t_l_&
pdcch_cfg_common_s::first_pdcch_monitoring_occasion_of_po_c_::set_scs60_kh_zone_t_scs30_kh_zhalf_t_scs15_kh_zquarter_t()
{
  set(types::scs60_kh_zone_t_scs30_kh_zhalf_t_scs15_kh_zquarter_t);
  return c.get<scs60_kh_zone_t_scs30_kh_zhalf_t_scs15_kh_zquarter_t_l_>();
}
pdcch_cfg_common_s::first_pdcch_monitoring_occasion_of_po_c_::
    scs120_kh_zone_t_scs60_kh_zhalf_t_scs30_kh_zquarter_t_scs15_kh_zone_eighth_t_l_&
    pdcch_cfg_common_s::first_pdcch_monitoring_occasion_of_po_c_::
        set_scs120_kh_zone_t_scs60_kh_zhalf_t_scs30_kh_zquarter_t_scs15_kh_zone_eighth_t()
{
  set(types::scs120_kh_zone_t_scs60_kh_zhalf_t_scs30_kh_zquarter_t_scs15_kh_zone_eighth_t);
  return c.get<scs120_kh_zone_t_scs60_kh_zhalf_t_scs30_kh_zquarter_t_scs15_kh_zone_eighth_t_l_>();
}
pdcch_cfg_common_s::first_pdcch_monitoring_occasion_of_po_c_::
    scs120_kh_zhalf_t_scs60_kh_zquarter_t_scs30_kh_zone_eighth_t_scs15_kh_zone_sixteenth_t_l_&
    pdcch_cfg_common_s::first_pdcch_monitoring_occasion_of_po_c_::
        set_scs120_kh_zhalf_t_scs60_kh_zquarter_t_scs30_kh_zone_eighth_t_scs15_kh_zone_sixteenth_t()
{
  set(types::scs120_kh_zhalf_t_scs60_kh_zquarter_t_scs30_kh_zone_eighth_t_scs15_kh_zone_sixteenth_t);
  return c.get<scs120_kh_zhalf_t_scs60_kh_zquarter_t_scs30_kh_zone_eighth_t_scs15_kh_zone_sixteenth_t_l_>();
}
pdcch_cfg_common_s::first_pdcch_monitoring_occasion_of_po_c_::
    scs120_kh_zquarter_t_scs60_kh_zone_eighth_t_scs30_kh_zone_sixteenth_t_l_&
    pdcch_cfg_common_s::first_pdcch_monitoring_occasion_of_po_c_::
        set_scs120_kh_zquarter_t_scs60_kh_zone_eighth_t_scs30_kh_zone_sixteenth_t()
{
  set(types::scs120_kh_zquarter_t_scs60_kh_zone_eighth_t_scs30_kh_zone_sixteenth_t);
  return c.get<scs120_kh_zquarter_t_scs60_kh_zone_eighth_t_scs30_kh_zone_sixteenth_t_l_>();
}
pdcch_cfg_common_s::first_pdcch_monitoring_occasion_of_po_c_::scs120_kh_zone_eighth_t_scs60_kh_zone_sixteenth_t_l_&
pdcch_cfg_common_s::first_pdcch_monitoring_occasion_of_po_c_::set_scs120_kh_zone_eighth_t_scs60_kh_zone_sixteenth_t()
{
  set(types::scs120_kh_zone_eighth_t_scs60_kh_zone_sixteenth_t);
  return c.get<scs120_kh_zone_eighth_t_scs60_kh_zone_sixteenth_t_l_>();
}
pdcch_cfg_common_s::first_pdcch_monitoring_occasion_of_po_c_::scs120_kh_zone_sixteenth_t_l_&
pdcch_cfg_common_s::first_pdcch_monitoring_occasion_of_po_c_::set_scs120_kh_zone_sixteenth_t()
{
  set(types::scs120_kh_zone_sixteenth_t);
  return c.get<scs120_kh_zone_sixteenth_t_l_>();
}
void pdcch_cfg_common_s::first_pdcch_monitoring_occasion_of_po_c_::to_json(json_writer& j) const
{
  j.start_obj();
  switch (type_) {
    case types::scs15_kh_zone_t:
      j.start_array("sCS15KHZoneT");
      for (const auto& e1 : c.get<scs15_kh_zone_t_l_>()) {
        j.write_int(e1);
      }
      j.end_array();
      break;
    case types::scs30_kh_zone_t_scs15_kh_zhalf_t:
      j.start_array("sCS30KHZoneT-SCS15KHZhalfT");
      for (const auto& e1 : c.get<scs30_kh_zone_t_scs15_kh_zhalf_t_l_>()) {
        j.write_int(e1);
      }
      j.end_array();
      break;
    case types::scs60_kh_zone_t_scs30_kh_zhalf_t_scs15_kh_zquarter_t:
      j.start_array("sCS60KHZoneT-SCS30KHZhalfT-SCS15KHZquarterT");
      for (const auto& e1 : c.get<scs60_kh_zone_t_scs30_kh_zhalf_t_scs15_kh_zquarter_t_l_>()) {
        j.write_int(e1);
      }
      j.end_array();
      break;
    case types::scs120_kh_zone_t_scs60_kh_zhalf_t_scs30_kh_zquarter_t_scs15_kh_zone_eighth_t:
      j.start_array("sCS120KHZoneT-SCS60KHZhalfT-SCS30KHZquarterT-SCS15KHZoneEighthT");
      for (const auto& e1 : c.get<scs120_kh_zone_t_scs60_kh_zhalf_t_scs30_kh_zquarter_t_scs15_kh_zone_eighth_t_l_>()) {
        j.write_int(e1);
      }
      j.end_array();
      break;
    case types::scs120_kh_zhalf_t_scs60_kh_zquarter_t_scs30_kh_zone_eighth_t_scs15_kh_zone_sixteenth_t:
      j.start_array("sCS120KHZhalfT-SCS60KHZquarterT-SCS30KHZoneEighthT-SCS15KHZoneSixteenthT");
      for (const auto& e1 :
           c.get<scs120_kh_zhalf_t_scs60_kh_zquarter_t_scs30_kh_zone_eighth_t_scs15_kh_zone_sixteenth_t_l_>()) {
        j.write_int(e1);
      }
      j.end_array();
      break;
    case types::scs120_kh_zquarter_t_scs60_kh_zone_eighth_t_scs30_kh_zone_sixteenth_t:
      j.start_array("sCS120KHZquarterT-SCS60KHZoneEighthT-SCS30KHZoneSixteenthT");
      for (const auto& e1 : c.get<scs120_kh_zquarter_t_scs60_kh_zone_eighth_t_scs30_kh_zone_sixteenth_t_l_>()) {
        j.write_int(e1);
      }
      j.end_array();
      break;
    case types::scs120_kh_zone_eighth_t_scs60_kh_zone_sixteenth_t:
      j.start_array("sCS120KHZoneEighthT-SCS60KHZoneSixteenthT");
      for (const auto& e1 : c.get<scs120_kh_zone_eighth_t_scs60_kh_zone_sixteenth_t_l_>()) {
        j.write_int(e1);
      }
      j.end_array();
      break;
    case types::scs120_kh_zone_sixteenth_t:
      j.start_array("sCS120KHZoneSixteenthT");
      for (const auto& e1 : c.get<scs120_kh_zone_sixteenth_t_l_>()) {
        j.write_int(e1);
      }
      j.end_array();
      break;
    default:
      log_invalid_choice_id(type_, "pdcch_cfg_common_s::first_pdcch_monitoring_occasion_of_po_c_");
  }
  j.end_obj();
}
SRSASN_CODE pdcch_cfg_common_s::first_pdcch_monitoring_occasion_of_po_c_::pack(bit_ref& bref) const
{
  type_.pack(bref);
  switch (type_) {
    case types::scs15_kh_zone_t:
      HANDLE_CODE(pack_dyn_seq_of(bref, c.get<scs15_kh_zone_t_l_>(), 1, 4, integer_packer<uint8_t>(0, 139)));
      break;
    case types::scs30_kh_zone_t_scs15_kh_zhalf_t:
      HANDLE_CODE(
          pack_dyn_seq_of(bref, c.get<scs30_kh_zone_t_scs15_kh_zhalf_t_l_>(), 1, 4, integer_packer<uint16_t>(0, 279)));
      break;
    case types::scs60_kh_zone_t_scs30_kh_zhalf_t_scs15_kh_zquarter_t:
      HANDLE_CODE(pack_dyn_seq_of(bref,
                                  c.get<scs60_kh_zone_t_scs30_kh_zhalf_t_scs15_kh_zquarter_t_l_>(),
                                  1,
                                  4,
                                  integer_packer<uint16_t>(0, 559)));
      break;
    case types::scs120_kh_zone_t_scs60_kh_zhalf_t_scs30_kh_zquarter_t_scs15_kh_zone_eighth_t:
      HANDLE_CODE(
          pack_dyn_seq_of(bref,
                          c.get<scs120_kh_zone_t_scs60_kh_zhalf_t_scs30_kh_zquarter_t_scs15_kh_zone_eighth_t_l_>(),
                          1,
                          4,
                          integer_packer<uint16_t>(0, 1119)));
      break;
    case types::scs120_kh_zhalf_t_scs60_kh_zquarter_t_scs30_kh_zone_eighth_t_scs15_kh_zone_sixteenth_t:
      HANDLE_CODE(pack_dyn_seq_of(
          bref,
          c.get<scs120_kh_zhalf_t_scs60_kh_zquarter_t_scs30_kh_zone_eighth_t_scs15_kh_zone_sixteenth_t_l_>(),
          1,
          4,
          integer_packer<uint16_t>(0, 2239)));
      break;
    case types::scs120_kh_zquarter_t_scs60_kh_zone_eighth_t_scs30_kh_zone_sixteenth_t:
      HANDLE_CODE(pack_dyn_seq_of(bref,
                                  c.get<scs120_kh_zquarter_t_scs60_kh_zone_eighth_t_scs30_kh_zone_sixteenth_t_l_>(),
                                  1,
                                  4,
                                  integer_packer<uint16_t>(0, 4479)));
      break;
    case types::scs120_kh_zone_eighth_t_scs60_kh_zone_sixteenth_t:
      HANDLE_CODE(pack_dyn_seq_of(bref,
                                  c.get<scs120_kh_zone_eighth_t_scs60_kh_zone_sixteenth_t_l_>(),
                                  1,
                                  4,
                                  integer_packer<uint16_t>(0, 8959)));
      break;
    case types::scs120_kh_zone_sixteenth_t:
      HANDLE_CODE(
          pack_dyn_seq_of(bref, c.get<scs120_kh_zone_sixteenth_t_l_>(), 1, 4, integer_packer<uint16_t>(0, 17919)));
      break;
    default:
      log_invalid_choice_id(type_, "pdcch_cfg_common_s::first_pdcch_monitoring_occasion_of_po_c_");
      return SRSASN_ERROR_ENCODE_FAIL;
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE pdcch_cfg_common_s::first_pdcch_monitoring_occasion_of_po_c_::unpack(cbit_ref& bref)
{
  types e;
  e.unpack(bref);
  set(e);
  switch (type_) {
    case types::scs15_kh_zone_t:
      HANDLE_CODE(unpack_dyn_seq_of(c.get<scs15_kh_zone_t_l_>(), bref, 1, 4, integer_packer<uint8_t>(0, 139)));
      break;
    case types::scs30_kh_zone_t_scs15_kh_zhalf_t:
      HANDLE_CODE(unpack_dyn_seq_of(
          c.get<scs30_kh_zone_t_scs15_kh_zhalf_t_l_>(), bref, 1, 4, integer_packer<uint16_t>(0, 279)));
      break;
    case types::scs60_kh_zone_t_scs30_kh_zhalf_t_scs15_kh_zquarter_t:
      HANDLE_CODE(unpack_dyn_seq_of(c.get<scs60_kh_zone_t_scs30_kh_zhalf_t_scs15_kh_zquarter_t_l_>(),
                                    bref,
                                    1,
                                    4,
                                    integer_packer<uint16_t>(0, 559)));
      break;
    case types::scs120_kh_zone_t_scs60_kh_zhalf_t_scs30_kh_zquarter_t_scs15_kh_zone_eighth_t:
      HANDLE_CODE(
          unpack_dyn_seq_of(c.get<scs120_kh_zone_t_scs60_kh_zhalf_t_scs30_kh_zquarter_t_scs15_kh_zone_eighth_t_l_>(),
                            bref,
                            1,
                            4,
                            integer_packer<uint16_t>(0, 1119)));
      break;
    case types::scs120_kh_zhalf_t_scs60_kh_zquarter_t_scs30_kh_zone_eighth_t_scs15_kh_zone_sixteenth_t:
      HANDLE_CODE(unpack_dyn_seq_of(
          c.get<scs120_kh_zhalf_t_scs60_kh_zquarter_t_scs30_kh_zone_eighth_t_scs15_kh_zone_sixteenth_t_l_>(),
          bref,
          1,
          4,
          integer_packer<uint16_t>(0, 2239)));
      break;
    case types::scs120_kh_zquarter_t_scs60_kh_zone_eighth_t_scs30_kh_zone_sixteenth_t:
      HANDLE_CODE(unpack_dyn_seq_of(c.get<scs120_kh_zquarter_t_scs60_kh_zone_eighth_t_scs30_kh_zone_sixteenth_t_l_>(),
                                    bref,
                                    1,
                                    4,
                                    integer_packer<uint16_t>(0, 4479)));
      break;
    case types::scs120_kh_zone_eighth_t_scs60_kh_zone_sixteenth_t:
      HANDLE_CODE(unpack_dyn_seq_of(c.get<scs120_kh_zone_eighth_t_scs60_kh_zone_sixteenth_t_l_>(),
                                    bref,
                                    1,
                                    4,
                                    integer_packer<uint16_t>(0, 8959)));
      break;
    case types::scs120_kh_zone_sixteenth_t:
      HANDLE_CODE(
          unpack_dyn_seq_of(c.get<scs120_kh_zone_sixteenth_t_l_>(), bref, 1, 4, integer_packer<uint16_t>(0, 17919)));
      break;
    default:
      log_invalid_choice_id(type_, "pdcch_cfg_common_s::first_pdcch_monitoring_occasion_of_po_c_");
      return SRSASN_ERROR_DECODE_FAIL;
  }
  return SRSASN_SUCCESS;
}

const char* pdcch_cfg_common_s::first_pdcch_monitoring_occasion_of_po_c_::types_opts::to_string() const
{
  static const char* names[] = {"sCS15KHZoneT",
                                "sCS30KHZoneT-SCS15KHZhalfT",
                                "sCS60KHZoneT-SCS30KHZhalfT-SCS15KHZquarterT",
                                "sCS120KHZoneT-SCS60KHZhalfT-SCS30KHZquarterT-SCS15KHZoneEighthT",
                                "sCS120KHZhalfT-SCS60KHZquarterT-SCS30KHZoneEighthT-SCS15KHZoneSixteenthT",
                                "sCS120KHZquarterT-SCS60KHZoneEighthT-SCS30KHZoneSixteenthT",
                                "sCS120KHZoneEighthT-SCS60KHZoneSixteenthT",
                                "sCS120KHZoneSixteenthT"};
  return convert_enum_idx(names, 8, value, "pdcch_cfg_common_s::first_pdcch_monitoring_occasion_of_po_c_::types");
}

void pdcch_cfg_common_s::sdt_search_space_r17_c_::destroy_()
{
  switch (type_) {
    case types::new_search_space:
      c.destroy<search_space_s>();
      break;
    default:
      break;
  }
}
void pdcch_cfg_common_s::sdt_search_space_r17_c_::set(types::options e)
{
  destroy_();
  type_ = e;
  switch (type_) {
    case types::new_search_space:
      c.init<search_space_s>();
      break;
    case types::existing_search_space:
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "pdcch_cfg_common_s::sdt_search_space_r17_c_");
  }
}
pdcch_cfg_common_s::sdt_search_space_r17_c_::sdt_search_space_r17_c_(
    const pdcch_cfg_common_s::sdt_search_space_r17_c_& other)
{
  type_ = other.type();
  switch (type_) {
    case types::new_search_space:
      c.init(other.c.get<search_space_s>());
      break;
    case types::existing_search_space:
      c.init(other.c.get<uint8_t>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "pdcch_cfg_common_s::sdt_search_space_r17_c_");
  }
}
pdcch_cfg_common_s::sdt_search_space_r17_c_&
pdcch_cfg_common_s::sdt_search_space_r17_c_::operator=(const pdcch_cfg_common_s::sdt_search_space_r17_c_& other)
{
  if (this == &other) {
    return *this;
  }
  set(other.type());
  switch (type_) {
    case types::new_search_space:
      c.set(other.c.get<search_space_s>());
      break;
    case types::existing_search_space:
      c.set(other.c.get<uint8_t>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "pdcch_cfg_common_s::sdt_search_space_r17_c_");
  }

  return *this;
}
search_space_s& pdcch_cfg_common_s::sdt_search_space_r17_c_::set_new_search_space()
{
  set(types::new_search_space);
  return c.get<search_space_s>();
}
uint8_t& pdcch_cfg_common_s::sdt_search_space_r17_c_::set_existing_search_space()
{
  set(types::existing_search_space);
  return c.get<uint8_t>();
}
void pdcch_cfg_common_s::sdt_search_space_r17_c_::to_json(json_writer& j) const
{
  j.start_obj();
  switch (type_) {
    case types::new_search_space:
      j.write_fieldname("newSearchSpace");
      c.get<search_space_s>().to_json(j);
      break;
    case types::existing_search_space:
      j.write_int("existingSearchSpace", c.get<uint8_t>());
      break;
    default:
      log_invalid_choice_id(type_, "pdcch_cfg_common_s::sdt_search_space_r17_c_");
  }
  j.end_obj();
}
SRSASN_CODE pdcch_cfg_common_s::sdt_search_space_r17_c_::pack(bit_ref& bref) const
{
  type_.pack(bref);
  switch (type_) {
    case types::new_search_space:
      HANDLE_CODE(c.get<search_space_s>().pack(bref));
      break;
    case types::existing_search_space:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)39u));
      break;
    default:
      log_invalid_choice_id(type_, "pdcch_cfg_common_s::sdt_search_space_r17_c_");
      return SRSASN_ERROR_ENCODE_FAIL;
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE pdcch_cfg_common_s::sdt_search_space_r17_c_::unpack(cbit_ref& bref)
{
  types e;
  e.unpack(bref);
  set(e);
  switch (type_) {
    case types::new_search_space:
      HANDLE_CODE(c.get<search_space_s>().unpack(bref));
      break;
    case types::existing_search_space:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)39u));
      break;
    default:
      log_invalid_choice_id(type_, "pdcch_cfg_common_s::sdt_search_space_r17_c_");
      return SRSASN_ERROR_DECODE_FAIL;
  }
  return SRSASN_SUCCESS;
}

const char* pdcch_cfg_common_s::sdt_search_space_r17_c_::types_opts::to_string() const
{
  static const char* names[] = {"newSearchSpace", "existingSearchSpace"};
  return convert_enum_idx(names, 2, value, "pdcch_cfg_common_s::sdt_search_space_r17_c_::types");
}

void pdcch_cfg_common_s::first_pdcch_monitoring_occasion_of_po_v1710_c_::destroy_()
{
  switch (type_) {
    case types::scs480_kh_zone_eighth_t:
      c.destroy<scs480_kh_zone_eighth_t_l_>();
      break;
    case types::scs480_kh_zone_sixteenth_t:
      c.destroy<scs480_kh_zone_sixteenth_t_l_>();
      break;
    default:
      break;
  }
}
void pdcch_cfg_common_s::first_pdcch_monitoring_occasion_of_po_v1710_c_::set(types::options e)
{
  destroy_();
  type_ = e;
  switch (type_) {
    case types::scs480_kh_zone_eighth_t:
      c.init<scs480_kh_zone_eighth_t_l_>();
      break;
    case types::scs480_kh_zone_sixteenth_t:
      c.init<scs480_kh_zone_sixteenth_t_l_>();
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "pdcch_cfg_common_s::first_pdcch_monitoring_occasion_of_po_v1710_c_");
  }
}
pdcch_cfg_common_s::first_pdcch_monitoring_occasion_of_po_v1710_c_::first_pdcch_monitoring_occasion_of_po_v1710_c_(
    const pdcch_cfg_common_s::first_pdcch_monitoring_occasion_of_po_v1710_c_& other)
{
  type_ = other.type();
  switch (type_) {
    case types::scs480_kh_zone_eighth_t:
      c.init(other.c.get<scs480_kh_zone_eighth_t_l_>());
      break;
    case types::scs480_kh_zone_sixteenth_t:
      c.init(other.c.get<scs480_kh_zone_sixteenth_t_l_>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "pdcch_cfg_common_s::first_pdcch_monitoring_occasion_of_po_v1710_c_");
  }
}
pdcch_cfg_common_s::first_pdcch_monitoring_occasion_of_po_v1710_c_&
pdcch_cfg_common_s::first_pdcch_monitoring_occasion_of_po_v1710_c_::operator=(
    const pdcch_cfg_common_s::first_pdcch_monitoring_occasion_of_po_v1710_c_& other)
{
  if (this == &other) {
    return *this;
  }
  set(other.type());
  switch (type_) {
    case types::scs480_kh_zone_eighth_t:
      c.set(other.c.get<scs480_kh_zone_eighth_t_l_>());
      break;
    case types::scs480_kh_zone_sixteenth_t:
      c.set(other.c.get<scs480_kh_zone_sixteenth_t_l_>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "pdcch_cfg_common_s::first_pdcch_monitoring_occasion_of_po_v1710_c_");
  }

  return *this;
}
pdcch_cfg_common_s::first_pdcch_monitoring_occasion_of_po_v1710_c_::scs480_kh_zone_eighth_t_l_&
pdcch_cfg_common_s::first_pdcch_monitoring_occasion_of_po_v1710_c_::set_scs480_kh_zone_eighth_t()
{
  set(types::scs480_kh_zone_eighth_t);
  return c.get<scs480_kh_zone_eighth_t_l_>();
}
pdcch_cfg_common_s::first_pdcch_monitoring_occasion_of_po_v1710_c_::scs480_kh_zone_sixteenth_t_l_&
pdcch_cfg_common_s::first_pdcch_monitoring_occasion_of_po_v1710_c_::set_scs480_kh_zone_sixteenth_t()
{
  set(types::scs480_kh_zone_sixteenth_t);
  return c.get<scs480_kh_zone_sixteenth_t_l_>();
}
void pdcch_cfg_common_s::first_pdcch_monitoring_occasion_of_po_v1710_c_::to_json(json_writer& j) const
{
  j.start_obj();
  switch (type_) {
    case types::scs480_kh_zone_eighth_t:
      j.start_array("sCS480KHZoneEighthT");
      for (const auto& e1 : c.get<scs480_kh_zone_eighth_t_l_>()) {
        j.write_int(e1);
      }
      j.end_array();
      break;
    case types::scs480_kh_zone_sixteenth_t:
      j.start_array("sCS480KHZoneSixteenthT");
      for (const auto& e1 : c.get<scs480_kh_zone_sixteenth_t_l_>()) {
        j.write_int(e1);
      }
      j.end_array();
      break;
    default:
      log_invalid_choice_id(type_, "pdcch_cfg_common_s::first_pdcch_monitoring_occasion_of_po_v1710_c_");
  }
  j.end_obj();
}
SRSASN_CODE pdcch_cfg_common_s::first_pdcch_monitoring_occasion_of_po_v1710_c_::pack(bit_ref& bref) const
{
  type_.pack(bref);
  switch (type_) {
    case types::scs480_kh_zone_eighth_t:
      HANDLE_CODE(pack_dyn_seq_of(bref, c.get<scs480_kh_zone_eighth_t_l_>(), 1, 4, integer_packer<uint16_t>(0, 35839)));
      break;
    case types::scs480_kh_zone_sixteenth_t:
      HANDLE_CODE(
          pack_dyn_seq_of(bref, c.get<scs480_kh_zone_sixteenth_t_l_>(), 1, 4, integer_packer<uint32_t>(0, 71679)));
      break;
    default:
      log_invalid_choice_id(type_, "pdcch_cfg_common_s::first_pdcch_monitoring_occasion_of_po_v1710_c_");
      return SRSASN_ERROR_ENCODE_FAIL;
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE pdcch_cfg_common_s::first_pdcch_monitoring_occasion_of_po_v1710_c_::unpack(cbit_ref& bref)
{
  types e;
  e.unpack(bref);
  set(e);
  switch (type_) {
    case types::scs480_kh_zone_eighth_t:
      HANDLE_CODE(
          unpack_dyn_seq_of(c.get<scs480_kh_zone_eighth_t_l_>(), bref, 1, 4, integer_packer<uint16_t>(0, 35839)));
      break;
    case types::scs480_kh_zone_sixteenth_t:
      HANDLE_CODE(
          unpack_dyn_seq_of(c.get<scs480_kh_zone_sixteenth_t_l_>(), bref, 1, 4, integer_packer<uint32_t>(0, 71679)));
      break;
    default:
      log_invalid_choice_id(type_, "pdcch_cfg_common_s::first_pdcch_monitoring_occasion_of_po_v1710_c_");
      return SRSASN_ERROR_DECODE_FAIL;
  }
  return SRSASN_SUCCESS;
}

const char* pdcch_cfg_common_s::first_pdcch_monitoring_occasion_of_po_v1710_c_::types_opts::to_string() const
{
  static const char* names[] = {"sCS480KHZoneEighthT", "sCS480KHZoneSixteenthT"};
  return convert_enum_idx(names, 2, value, "pdcch_cfg_common_s::first_pdcch_monitoring_occasion_of_po_v1710_c_::types");
}

void pdcch_cfg_common_s::pei_cfg_bwp_r17_s_::first_pdcch_monitoring_occasion_of_pei_o_r17_c_::destroy_()
{
  switch (type_) {
    case types::scs15_kh_zone_t:
      c.destroy<scs15_kh_zone_t_l_>();
      break;
    case types::scs30_kh_zone_t_scs15_kh_zhalf_t:
      c.destroy<scs30_kh_zone_t_scs15_kh_zhalf_t_l_>();
      break;
    case types::scs60_kh_zone_t_scs30_kh_zhalf_t_scs15_kh_zquarter_t:
      c.destroy<scs60_kh_zone_t_scs30_kh_zhalf_t_scs15_kh_zquarter_t_l_>();
      break;
    case types::scs120_kh_zone_t_scs60_kh_zhalf_t_scs30_kh_zquarter_t_scs15_kh_zone_eighth_t:
      c.destroy<scs120_kh_zone_t_scs60_kh_zhalf_t_scs30_kh_zquarter_t_scs15_kh_zone_eighth_t_l_>();
      break;
    case types::scs120_kh_zhalf_t_scs60_kh_zquarter_t_scs30_kh_zone_eighth_t_scs15_kh_zone_sixteenth_t:
      c.destroy<scs120_kh_zhalf_t_scs60_kh_zquarter_t_scs30_kh_zone_eighth_t_scs15_kh_zone_sixteenth_t_l_>();
      break;
    case types::scs480_kh_zone_t_scs120_kh_zquarter_t_scs60_kh_zone_eighth_t_scs30_kh_zone_sixteenth_t:
      c.destroy<scs480_kh_zone_t_scs120_kh_zquarter_t_scs60_kh_zone_eighth_t_scs30_kh_zone_sixteenth_t_l_>();
      break;
    case types::scs480_kh_zhalf_t_scs120_kh_zone_eighth_t_scs60_kh_zone_sixteenth_t:
      c.destroy<scs480_kh_zhalf_t_scs120_kh_zone_eighth_t_scs60_kh_zone_sixteenth_t_l_>();
      break;
    case types::scs480_kh_zquarter_t_scs120_kh_zone_sixteenth_t:
      c.destroy<scs480_kh_zquarter_t_scs120_kh_zone_sixteenth_t_l_>();
      break;
    case types::scs480_kh_zone_eighth_t:
      c.destroy<scs480_kh_zone_eighth_t_l_>();
      break;
    case types::scs480_kh_zone_sixteenth_t:
      c.destroy<scs480_kh_zone_sixteenth_t_l_>();
      break;
    default:
      break;
  }
}
void pdcch_cfg_common_s::pei_cfg_bwp_r17_s_::first_pdcch_monitoring_occasion_of_pei_o_r17_c_::set(types::options e)
{
  destroy_();
  type_ = e;
  switch (type_) {
    case types::scs15_kh_zone_t:
      c.init<scs15_kh_zone_t_l_>();
      break;
    case types::scs30_kh_zone_t_scs15_kh_zhalf_t:
      c.init<scs30_kh_zone_t_scs15_kh_zhalf_t_l_>();
      break;
    case types::scs60_kh_zone_t_scs30_kh_zhalf_t_scs15_kh_zquarter_t:
      c.init<scs60_kh_zone_t_scs30_kh_zhalf_t_scs15_kh_zquarter_t_l_>();
      break;
    case types::scs120_kh_zone_t_scs60_kh_zhalf_t_scs30_kh_zquarter_t_scs15_kh_zone_eighth_t:
      c.init<scs120_kh_zone_t_scs60_kh_zhalf_t_scs30_kh_zquarter_t_scs15_kh_zone_eighth_t_l_>();
      break;
    case types::scs120_kh_zhalf_t_scs60_kh_zquarter_t_scs30_kh_zone_eighth_t_scs15_kh_zone_sixteenth_t:
      c.init<scs120_kh_zhalf_t_scs60_kh_zquarter_t_scs30_kh_zone_eighth_t_scs15_kh_zone_sixteenth_t_l_>();
      break;
    case types::scs480_kh_zone_t_scs120_kh_zquarter_t_scs60_kh_zone_eighth_t_scs30_kh_zone_sixteenth_t:
      c.init<scs480_kh_zone_t_scs120_kh_zquarter_t_scs60_kh_zone_eighth_t_scs30_kh_zone_sixteenth_t_l_>();
      break;
    case types::scs480_kh_zhalf_t_scs120_kh_zone_eighth_t_scs60_kh_zone_sixteenth_t:
      c.init<scs480_kh_zhalf_t_scs120_kh_zone_eighth_t_scs60_kh_zone_sixteenth_t_l_>();
      break;
    case types::scs480_kh_zquarter_t_scs120_kh_zone_sixteenth_t:
      c.init<scs480_kh_zquarter_t_scs120_kh_zone_sixteenth_t_l_>();
      break;
    case types::scs480_kh_zone_eighth_t:
      c.init<scs480_kh_zone_eighth_t_l_>();
      break;
    case types::scs480_kh_zone_sixteenth_t:
      c.init<scs480_kh_zone_sixteenth_t_l_>();
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_,
                            "pdcch_cfg_common_s::pei_cfg_bwp_r17_s_::first_pdcch_monitoring_occasion_of_pei_o_r17_c_");
  }
}
pdcch_cfg_common_s::pei_cfg_bwp_r17_s_::first_pdcch_monitoring_occasion_of_pei_o_r17_c_::
    first_pdcch_monitoring_occasion_of_pei_o_r17_c_(
        const pdcch_cfg_common_s::pei_cfg_bwp_r17_s_::first_pdcch_monitoring_occasion_of_pei_o_r17_c_& other)
{
  type_ = other.type();
  switch (type_) {
    case types::scs15_kh_zone_t:
      c.init(other.c.get<scs15_kh_zone_t_l_>());
      break;
    case types::scs30_kh_zone_t_scs15_kh_zhalf_t:
      c.init(other.c.get<scs30_kh_zone_t_scs15_kh_zhalf_t_l_>());
      break;
    case types::scs60_kh_zone_t_scs30_kh_zhalf_t_scs15_kh_zquarter_t:
      c.init(other.c.get<scs60_kh_zone_t_scs30_kh_zhalf_t_scs15_kh_zquarter_t_l_>());
      break;
    case types::scs120_kh_zone_t_scs60_kh_zhalf_t_scs30_kh_zquarter_t_scs15_kh_zone_eighth_t:
      c.init(other.c.get<scs120_kh_zone_t_scs60_kh_zhalf_t_scs30_kh_zquarter_t_scs15_kh_zone_eighth_t_l_>());
      break;
    case types::scs120_kh_zhalf_t_scs60_kh_zquarter_t_scs30_kh_zone_eighth_t_scs15_kh_zone_sixteenth_t:
      c.init(other.c.get<scs120_kh_zhalf_t_scs60_kh_zquarter_t_scs30_kh_zone_eighth_t_scs15_kh_zone_sixteenth_t_l_>());
      break;
    case types::scs480_kh_zone_t_scs120_kh_zquarter_t_scs60_kh_zone_eighth_t_scs30_kh_zone_sixteenth_t:
      c.init(other.c.get<scs480_kh_zone_t_scs120_kh_zquarter_t_scs60_kh_zone_eighth_t_scs30_kh_zone_sixteenth_t_l_>());
      break;
    case types::scs480_kh_zhalf_t_scs120_kh_zone_eighth_t_scs60_kh_zone_sixteenth_t:
      c.init(other.c.get<scs480_kh_zhalf_t_scs120_kh_zone_eighth_t_scs60_kh_zone_sixteenth_t_l_>());
      break;
    case types::scs480_kh_zquarter_t_scs120_kh_zone_sixteenth_t:
      c.init(other.c.get<scs480_kh_zquarter_t_scs120_kh_zone_sixteenth_t_l_>());
      break;
    case types::scs480_kh_zone_eighth_t:
      c.init(other.c.get<scs480_kh_zone_eighth_t_l_>());
      break;
    case types::scs480_kh_zone_sixteenth_t:
      c.init(other.c.get<scs480_kh_zone_sixteenth_t_l_>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_,
                            "pdcch_cfg_common_s::pei_cfg_bwp_r17_s_::first_pdcch_monitoring_occasion_of_pei_o_r17_c_");
  }
}
pdcch_cfg_common_s::pei_cfg_bwp_r17_s_::first_pdcch_monitoring_occasion_of_pei_o_r17_c_&
pdcch_cfg_common_s::pei_cfg_bwp_r17_s_::first_pdcch_monitoring_occasion_of_pei_o_r17_c_::operator=(
    const pdcch_cfg_common_s::pei_cfg_bwp_r17_s_::first_pdcch_monitoring_occasion_of_pei_o_r17_c_& other)
{
  if (this == &other) {
    return *this;
  }
  set(other.type());
  switch (type_) {
    case types::scs15_kh_zone_t:
      c.set(other.c.get<scs15_kh_zone_t_l_>());
      break;
    case types::scs30_kh_zone_t_scs15_kh_zhalf_t:
      c.set(other.c.get<scs30_kh_zone_t_scs15_kh_zhalf_t_l_>());
      break;
    case types::scs60_kh_zone_t_scs30_kh_zhalf_t_scs15_kh_zquarter_t:
      c.set(other.c.get<scs60_kh_zone_t_scs30_kh_zhalf_t_scs15_kh_zquarter_t_l_>());
      break;
    case types::scs120_kh_zone_t_scs60_kh_zhalf_t_scs30_kh_zquarter_t_scs15_kh_zone_eighth_t:
      c.set(other.c.get<scs120_kh_zone_t_scs60_kh_zhalf_t_scs30_kh_zquarter_t_scs15_kh_zone_eighth_t_l_>());
      break;
    case types::scs120_kh_zhalf_t_scs60_kh_zquarter_t_scs30_kh_zone_eighth_t_scs15_kh_zone_sixteenth_t:
      c.set(other.c.get<scs120_kh_zhalf_t_scs60_kh_zquarter_t_scs30_kh_zone_eighth_t_scs15_kh_zone_sixteenth_t_l_>());
      break;
    case types::scs480_kh_zone_t_scs120_kh_zquarter_t_scs60_kh_zone_eighth_t_scs30_kh_zone_sixteenth_t:
      c.set(other.c.get<scs480_kh_zone_t_scs120_kh_zquarter_t_scs60_kh_zone_eighth_t_scs30_kh_zone_sixteenth_t_l_>());
      break;
    case types::scs480_kh_zhalf_t_scs120_kh_zone_eighth_t_scs60_kh_zone_sixteenth_t:
      c.set(other.c.get<scs480_kh_zhalf_t_scs120_kh_zone_eighth_t_scs60_kh_zone_sixteenth_t_l_>());
      break;
    case types::scs480_kh_zquarter_t_scs120_kh_zone_sixteenth_t:
      c.set(other.c.get<scs480_kh_zquarter_t_scs120_kh_zone_sixteenth_t_l_>());
      break;
    case types::scs480_kh_zone_eighth_t:
      c.set(other.c.get<scs480_kh_zone_eighth_t_l_>());
      break;
    case types::scs480_kh_zone_sixteenth_t:
      c.set(other.c.get<scs480_kh_zone_sixteenth_t_l_>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_,
                            "pdcch_cfg_common_s::pei_cfg_bwp_r17_s_::first_pdcch_monitoring_occasion_of_pei_o_r17_c_");
  }

  return *this;
}
pdcch_cfg_common_s::pei_cfg_bwp_r17_s_::first_pdcch_monitoring_occasion_of_pei_o_r17_c_::scs15_kh_zone_t_l_&
pdcch_cfg_common_s::pei_cfg_bwp_r17_s_::first_pdcch_monitoring_occasion_of_pei_o_r17_c_::set_scs15_kh_zone_t()
{
  set(types::scs15_kh_zone_t);
  return c.get<scs15_kh_zone_t_l_>();
}
pdcch_cfg_common_s::pei_cfg_bwp_r17_s_::first_pdcch_monitoring_occasion_of_pei_o_r17_c_::
    scs30_kh_zone_t_scs15_kh_zhalf_t_l_&
    pdcch_cfg_common_s::pei_cfg_bwp_r17_s_::first_pdcch_monitoring_occasion_of_pei_o_r17_c_::
        set_scs30_kh_zone_t_scs15_kh_zhalf_t()
{
  set(types::scs30_kh_zone_t_scs15_kh_zhalf_t);
  return c.get<scs30_kh_zone_t_scs15_kh_zhalf_t_l_>();
}
pdcch_cfg_common_s::pei_cfg_bwp_r17_s_::first_pdcch_monitoring_occasion_of_pei_o_r17_c_::
    scs60_kh_zone_t_scs30_kh_zhalf_t_scs15_kh_zquarter_t_l_&
    pdcch_cfg_common_s::pei_cfg_bwp_r17_s_::first_pdcch_monitoring_occasion_of_pei_o_r17_c_::
        set_scs60_kh_zone_t_scs30_kh_zhalf_t_scs15_kh_zquarter_t()
{
  set(types::scs60_kh_zone_t_scs30_kh_zhalf_t_scs15_kh_zquarter_t);
  return c.get<scs60_kh_zone_t_scs30_kh_zhalf_t_scs15_kh_zquarter_t_l_>();
}
pdcch_cfg_common_s::pei_cfg_bwp_r17_s_::first_pdcch_monitoring_occasion_of_pei_o_r17_c_::
    scs120_kh_zone_t_scs60_kh_zhalf_t_scs30_kh_zquarter_t_scs15_kh_zone_eighth_t_l_&
    pdcch_cfg_common_s::pei_cfg_bwp_r17_s_::first_pdcch_monitoring_occasion_of_pei_o_r17_c_::
        set_scs120_kh_zone_t_scs60_kh_zhalf_t_scs30_kh_zquarter_t_scs15_kh_zone_eighth_t()
{
  set(types::scs120_kh_zone_t_scs60_kh_zhalf_t_scs30_kh_zquarter_t_scs15_kh_zone_eighth_t);
  return c.get<scs120_kh_zone_t_scs60_kh_zhalf_t_scs30_kh_zquarter_t_scs15_kh_zone_eighth_t_l_>();
}
pdcch_cfg_common_s::pei_cfg_bwp_r17_s_::first_pdcch_monitoring_occasion_of_pei_o_r17_c_::
    scs120_kh_zhalf_t_scs60_kh_zquarter_t_scs30_kh_zone_eighth_t_scs15_kh_zone_sixteenth_t_l_&
    pdcch_cfg_common_s::pei_cfg_bwp_r17_s_::first_pdcch_monitoring_occasion_of_pei_o_r17_c_::
        set_scs120_kh_zhalf_t_scs60_kh_zquarter_t_scs30_kh_zone_eighth_t_scs15_kh_zone_sixteenth_t()
{
  set(types::scs120_kh_zhalf_t_scs60_kh_zquarter_t_scs30_kh_zone_eighth_t_scs15_kh_zone_sixteenth_t);
  return c.get<scs120_kh_zhalf_t_scs60_kh_zquarter_t_scs30_kh_zone_eighth_t_scs15_kh_zone_sixteenth_t_l_>();
}
pdcch_cfg_common_s::pei_cfg_bwp_r17_s_::first_pdcch_monitoring_occasion_of_pei_o_r17_c_::
    scs480_kh_zone_t_scs120_kh_zquarter_t_scs60_kh_zone_eighth_t_scs30_kh_zone_sixteenth_t_l_&
    pdcch_cfg_common_s::pei_cfg_bwp_r17_s_::first_pdcch_monitoring_occasion_of_pei_o_r17_c_::
        set_scs480_kh_zone_t_scs120_kh_zquarter_t_scs60_kh_zone_eighth_t_scs30_kh_zone_sixteenth_t()
{
  set(types::scs480_kh_zone_t_scs120_kh_zquarter_t_scs60_kh_zone_eighth_t_scs30_kh_zone_sixteenth_t);
  return c.get<scs480_kh_zone_t_scs120_kh_zquarter_t_scs60_kh_zone_eighth_t_scs30_kh_zone_sixteenth_t_l_>();
}
pdcch_cfg_common_s::pei_cfg_bwp_r17_s_::first_pdcch_monitoring_occasion_of_pei_o_r17_c_::
    scs480_kh_zhalf_t_scs120_kh_zone_eighth_t_scs60_kh_zone_sixteenth_t_l_&
    pdcch_cfg_common_s::pei_cfg_bwp_r17_s_::first_pdcch_monitoring_occasion_of_pei_o_r17_c_::
        set_scs480_kh_zhalf_t_scs120_kh_zone_eighth_t_scs60_kh_zone_sixteenth_t()
{
  set(types::scs480_kh_zhalf_t_scs120_kh_zone_eighth_t_scs60_kh_zone_sixteenth_t);
  return c.get<scs480_kh_zhalf_t_scs120_kh_zone_eighth_t_scs60_kh_zone_sixteenth_t_l_>();
}
pdcch_cfg_common_s::pei_cfg_bwp_r17_s_::first_pdcch_monitoring_occasion_of_pei_o_r17_c_::
    scs480_kh_zquarter_t_scs120_kh_zone_sixteenth_t_l_&
    pdcch_cfg_common_s::pei_cfg_bwp_r17_s_::first_pdcch_monitoring_occasion_of_pei_o_r17_c_::
        set_scs480_kh_zquarter_t_scs120_kh_zone_sixteenth_t()
{
  set(types::scs480_kh_zquarter_t_scs120_kh_zone_sixteenth_t);
  return c.get<scs480_kh_zquarter_t_scs120_kh_zone_sixteenth_t_l_>();
}
pdcch_cfg_common_s::pei_cfg_bwp_r17_s_::first_pdcch_monitoring_occasion_of_pei_o_r17_c_::scs480_kh_zone_eighth_t_l_&
pdcch_cfg_common_s::pei_cfg_bwp_r17_s_::first_pdcch_monitoring_occasion_of_pei_o_r17_c_::set_scs480_kh_zone_eighth_t()
{
  set(types::scs480_kh_zone_eighth_t);
  return c.get<scs480_kh_zone_eighth_t_l_>();
}
pdcch_cfg_common_s::pei_cfg_bwp_r17_s_::first_pdcch_monitoring_occasion_of_pei_o_r17_c_::scs480_kh_zone_sixteenth_t_l_&
pdcch_cfg_common_s::pei_cfg_bwp_r17_s_::first_pdcch_monitoring_occasion_of_pei_o_r17_c_::
    set_scs480_kh_zone_sixteenth_t()
{
  set(types::scs480_kh_zone_sixteenth_t);
  return c.get<scs480_kh_zone_sixteenth_t_l_>();
}
void pdcch_cfg_common_s::pei_cfg_bwp_r17_s_::first_pdcch_monitoring_occasion_of_pei_o_r17_c_::to_json(
    json_writer& j) const
{
  j.start_obj();
  switch (type_) {
    case types::scs15_kh_zone_t:
      j.start_array("sCS15KHZoneT");
      for (const auto& e1 : c.get<scs15_kh_zone_t_l_>()) {
        j.write_int(e1);
      }
      j.end_array();
      break;
    case types::scs30_kh_zone_t_scs15_kh_zhalf_t:
      j.start_array("sCS30KHZoneT-SCS15KHZhalfT");
      for (const auto& e1 : c.get<scs30_kh_zone_t_scs15_kh_zhalf_t_l_>()) {
        j.write_int(e1);
      }
      j.end_array();
      break;
    case types::scs60_kh_zone_t_scs30_kh_zhalf_t_scs15_kh_zquarter_t:
      j.start_array("sCS60KHZoneT-SCS30KHZhalfT-SCS15KHZquarterT");
      for (const auto& e1 : c.get<scs60_kh_zone_t_scs30_kh_zhalf_t_scs15_kh_zquarter_t_l_>()) {
        j.write_int(e1);
      }
      j.end_array();
      break;
    case types::scs120_kh_zone_t_scs60_kh_zhalf_t_scs30_kh_zquarter_t_scs15_kh_zone_eighth_t:
      j.start_array("sCS120KHZoneT-SCS60KHZhalfT-SCS30KHZquarterT-SCS15KHZoneEighthT");
      for (const auto& e1 : c.get<scs120_kh_zone_t_scs60_kh_zhalf_t_scs30_kh_zquarter_t_scs15_kh_zone_eighth_t_l_>()) {
        j.write_int(e1);
      }
      j.end_array();
      break;
    case types::scs120_kh_zhalf_t_scs60_kh_zquarter_t_scs30_kh_zone_eighth_t_scs15_kh_zone_sixteenth_t:
      j.start_array("sCS120KHZhalfT-SCS60KHZquarterT-SCS30KHZoneEighthT-SCS15KHZoneSixteenthT");
      for (const auto& e1 :
           c.get<scs120_kh_zhalf_t_scs60_kh_zquarter_t_scs30_kh_zone_eighth_t_scs15_kh_zone_sixteenth_t_l_>()) {
        j.write_int(e1);
      }
      j.end_array();
      break;
    case types::scs480_kh_zone_t_scs120_kh_zquarter_t_scs60_kh_zone_eighth_t_scs30_kh_zone_sixteenth_t:
      j.start_array("sCS480KHZoneT-SCS120KHZquarterT-SCS60KHZoneEighthT-SCS30KHZoneSixteenthT");
      for (const auto& e1 :
           c.get<scs480_kh_zone_t_scs120_kh_zquarter_t_scs60_kh_zone_eighth_t_scs30_kh_zone_sixteenth_t_l_>()) {
        j.write_int(e1);
      }
      j.end_array();
      break;
    case types::scs480_kh_zhalf_t_scs120_kh_zone_eighth_t_scs60_kh_zone_sixteenth_t:
      j.start_array("sCS480KHZhalfT-SCS120KHZoneEighthT-SCS60KHZoneSixteenthT");
      for (const auto& e1 : c.get<scs480_kh_zhalf_t_scs120_kh_zone_eighth_t_scs60_kh_zone_sixteenth_t_l_>()) {
        j.write_int(e1);
      }
      j.end_array();
      break;
    case types::scs480_kh_zquarter_t_scs120_kh_zone_sixteenth_t:
      j.start_array("sCS480KHZquarterT-SCS120KHZoneSixteenthT");
      for (const auto& e1 : c.get<scs480_kh_zquarter_t_scs120_kh_zone_sixteenth_t_l_>()) {
        j.write_int(e1);
      }
      j.end_array();
      break;
    case types::scs480_kh_zone_eighth_t:
      j.start_array("sCS480KHZoneEighthT");
      for (const auto& e1 : c.get<scs480_kh_zone_eighth_t_l_>()) {
        j.write_int(e1);
      }
      j.end_array();
      break;
    case types::scs480_kh_zone_sixteenth_t:
      j.start_array("sCS480KHZoneSixteenthT");
      for (const auto& e1 : c.get<scs480_kh_zone_sixteenth_t_l_>()) {
        j.write_int(e1);
      }
      j.end_array();
      break;
    default:
      log_invalid_choice_id(type_,
                            "pdcch_cfg_common_s::pei_cfg_bwp_r17_s_::first_pdcch_monitoring_occasion_of_pei_o_r17_c_");
  }
  j.end_obj();
}
SRSASN_CODE
pdcch_cfg_common_s::pei_cfg_bwp_r17_s_::first_pdcch_monitoring_occasion_of_pei_o_r17_c_::pack(bit_ref& bref) const
{
  type_.pack(bref);
  switch (type_) {
    case types::scs15_kh_zone_t:
      HANDLE_CODE(pack_dyn_seq_of(bref, c.get<scs15_kh_zone_t_l_>(), 1, 4, integer_packer<uint8_t>(0, 139)));
      break;
    case types::scs30_kh_zone_t_scs15_kh_zhalf_t:
      HANDLE_CODE(
          pack_dyn_seq_of(bref, c.get<scs30_kh_zone_t_scs15_kh_zhalf_t_l_>(), 1, 4, integer_packer<uint16_t>(0, 279)));
      break;
    case types::scs60_kh_zone_t_scs30_kh_zhalf_t_scs15_kh_zquarter_t:
      HANDLE_CODE(pack_dyn_seq_of(bref,
                                  c.get<scs60_kh_zone_t_scs30_kh_zhalf_t_scs15_kh_zquarter_t_l_>(),
                                  1,
                                  4,
                                  integer_packer<uint16_t>(0, 559)));
      break;
    case types::scs120_kh_zone_t_scs60_kh_zhalf_t_scs30_kh_zquarter_t_scs15_kh_zone_eighth_t:
      HANDLE_CODE(
          pack_dyn_seq_of(bref,
                          c.get<scs120_kh_zone_t_scs60_kh_zhalf_t_scs30_kh_zquarter_t_scs15_kh_zone_eighth_t_l_>(),
                          1,
                          4,
                          integer_packer<uint16_t>(0, 1119)));
      break;
    case types::scs120_kh_zhalf_t_scs60_kh_zquarter_t_scs30_kh_zone_eighth_t_scs15_kh_zone_sixteenth_t:
      HANDLE_CODE(pack_dyn_seq_of(
          bref,
          c.get<scs120_kh_zhalf_t_scs60_kh_zquarter_t_scs30_kh_zone_eighth_t_scs15_kh_zone_sixteenth_t_l_>(),
          1,
          4,
          integer_packer<uint16_t>(0, 2239)));
      break;
    case types::scs480_kh_zone_t_scs120_kh_zquarter_t_scs60_kh_zone_eighth_t_scs30_kh_zone_sixteenth_t:
      HANDLE_CODE(pack_dyn_seq_of(
          bref,
          c.get<scs480_kh_zone_t_scs120_kh_zquarter_t_scs60_kh_zone_eighth_t_scs30_kh_zone_sixteenth_t_l_>(),
          1,
          4,
          integer_packer<uint16_t>(0, 4479)));
      break;
    case types::scs480_kh_zhalf_t_scs120_kh_zone_eighth_t_scs60_kh_zone_sixteenth_t:
      HANDLE_CODE(pack_dyn_seq_of(bref,
                                  c.get<scs480_kh_zhalf_t_scs120_kh_zone_eighth_t_scs60_kh_zone_sixteenth_t_l_>(),
                                  1,
                                  4,
                                  integer_packer<uint16_t>(0, 8959)));
      break;
    case types::scs480_kh_zquarter_t_scs120_kh_zone_sixteenth_t:
      HANDLE_CODE(pack_dyn_seq_of(
          bref, c.get<scs480_kh_zquarter_t_scs120_kh_zone_sixteenth_t_l_>(), 1, 4, integer_packer<uint16_t>(0, 17919)));
      break;
    case types::scs480_kh_zone_eighth_t:
      HANDLE_CODE(pack_dyn_seq_of(bref, c.get<scs480_kh_zone_eighth_t_l_>(), 1, 4, integer_packer<uint16_t>(0, 35839)));
      break;
    case types::scs480_kh_zone_sixteenth_t:
      HANDLE_CODE(
          pack_dyn_seq_of(bref, c.get<scs480_kh_zone_sixteenth_t_l_>(), 1, 4, integer_packer<uint32_t>(0, 71679)));
      break;
    default:
      log_invalid_choice_id(type_,
                            "pdcch_cfg_common_s::pei_cfg_bwp_r17_s_::first_pdcch_monitoring_occasion_of_pei_o_r17_c_");
      return SRSASN_ERROR_ENCODE_FAIL;
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE
pdcch_cfg_common_s::pei_cfg_bwp_r17_s_::first_pdcch_monitoring_occasion_of_pei_o_r17_c_::unpack(cbit_ref& bref)
{
  types e;
  e.unpack(bref);
  set(e);
  switch (type_) {
    case types::scs15_kh_zone_t:
      HANDLE_CODE(unpack_dyn_seq_of(c.get<scs15_kh_zone_t_l_>(), bref, 1, 4, integer_packer<uint8_t>(0, 139)));
      break;
    case types::scs30_kh_zone_t_scs15_kh_zhalf_t:
      HANDLE_CODE(unpack_dyn_seq_of(
          c.get<scs30_kh_zone_t_scs15_kh_zhalf_t_l_>(), bref, 1, 4, integer_packer<uint16_t>(0, 279)));
      break;
    case types::scs60_kh_zone_t_scs30_kh_zhalf_t_scs15_kh_zquarter_t:
      HANDLE_CODE(unpack_dyn_seq_of(c.get<scs60_kh_zone_t_scs30_kh_zhalf_t_scs15_kh_zquarter_t_l_>(),
                                    bref,
                                    1,
                                    4,
                                    integer_packer<uint16_t>(0, 559)));
      break;
    case types::scs120_kh_zone_t_scs60_kh_zhalf_t_scs30_kh_zquarter_t_scs15_kh_zone_eighth_t:
      HANDLE_CODE(
          unpack_dyn_seq_of(c.get<scs120_kh_zone_t_scs60_kh_zhalf_t_scs30_kh_zquarter_t_scs15_kh_zone_eighth_t_l_>(),
                            bref,
                            1,
                            4,
                            integer_packer<uint16_t>(0, 1119)));
      break;
    case types::scs120_kh_zhalf_t_scs60_kh_zquarter_t_scs30_kh_zone_eighth_t_scs15_kh_zone_sixteenth_t:
      HANDLE_CODE(unpack_dyn_seq_of(
          c.get<scs120_kh_zhalf_t_scs60_kh_zquarter_t_scs30_kh_zone_eighth_t_scs15_kh_zone_sixteenth_t_l_>(),
          bref,
          1,
          4,
          integer_packer<uint16_t>(0, 2239)));
      break;
    case types::scs480_kh_zone_t_scs120_kh_zquarter_t_scs60_kh_zone_eighth_t_scs30_kh_zone_sixteenth_t:
      HANDLE_CODE(unpack_dyn_seq_of(
          c.get<scs480_kh_zone_t_scs120_kh_zquarter_t_scs60_kh_zone_eighth_t_scs30_kh_zone_sixteenth_t_l_>(),
          bref,
          1,
          4,
          integer_packer<uint16_t>(0, 4479)));
      break;
    case types::scs480_kh_zhalf_t_scs120_kh_zone_eighth_t_scs60_kh_zone_sixteenth_t:
      HANDLE_CODE(unpack_dyn_seq_of(c.get<scs480_kh_zhalf_t_scs120_kh_zone_eighth_t_scs60_kh_zone_sixteenth_t_l_>(),
                                    bref,
                                    1,
                                    4,
                                    integer_packer<uint16_t>(0, 8959)));
      break;
    case types::scs480_kh_zquarter_t_scs120_kh_zone_sixteenth_t:
      HANDLE_CODE(unpack_dyn_seq_of(
          c.get<scs480_kh_zquarter_t_scs120_kh_zone_sixteenth_t_l_>(), bref, 1, 4, integer_packer<uint16_t>(0, 17919)));
      break;
    case types::scs480_kh_zone_eighth_t:
      HANDLE_CODE(
          unpack_dyn_seq_of(c.get<scs480_kh_zone_eighth_t_l_>(), bref, 1, 4, integer_packer<uint16_t>(0, 35839)));
      break;
    case types::scs480_kh_zone_sixteenth_t:
      HANDLE_CODE(
          unpack_dyn_seq_of(c.get<scs480_kh_zone_sixteenth_t_l_>(), bref, 1, 4, integer_packer<uint32_t>(0, 71679)));
      break;
    default:
      log_invalid_choice_id(type_,
                            "pdcch_cfg_common_s::pei_cfg_bwp_r17_s_::first_pdcch_monitoring_occasion_of_pei_o_r17_c_");
      return SRSASN_ERROR_DECODE_FAIL;
  }
  return SRSASN_SUCCESS;
}

const char*
pdcch_cfg_common_s::pei_cfg_bwp_r17_s_::first_pdcch_monitoring_occasion_of_pei_o_r17_c_::types_opts::to_string() const
{
  static const char* names[] = {"sCS15KHZoneT",
                                "sCS30KHZoneT-SCS15KHZhalfT",
                                "sCS60KHZoneT-SCS30KHZhalfT-SCS15KHZquarterT",
                                "sCS120KHZoneT-SCS60KHZhalfT-SCS30KHZquarterT-SCS15KHZoneEighthT",
                                "sCS120KHZhalfT-SCS60KHZquarterT-SCS30KHZoneEighthT-SCS15KHZoneSixteenthT",
                                "sCS480KHZoneT-SCS120KHZquarterT-SCS60KHZoneEighthT-SCS30KHZoneSixteenthT",
                                "sCS480KHZhalfT-SCS120KHZoneEighthT-SCS60KHZoneSixteenthT",
                                "sCS480KHZquarterT-SCS120KHZoneSixteenthT",
                                "sCS480KHZoneEighthT",
                                "sCS480KHZoneSixteenthT"};
  return convert_enum_idx(
      names,
      10,
      value,
      "pdcch_cfg_common_s::pei_cfg_bwp_r17_s_::first_pdcch_monitoring_occasion_of_pei_o_r17_c_::types");
}

// PDSCH-ConfigCommon ::= SEQUENCE
SRSASN_CODE pdsch_cfg_common_s::pack(bit_ref& bref) const
{
  bref.pack(ext, 1);
  HANDLE_CODE(bref.pack(pdsch_time_domain_alloc_list.size() > 0, 1));

  if (pdsch_time_domain_alloc_list.size() > 0) {
    HANDLE_CODE(pack_dyn_seq_of(bref, pdsch_time_domain_alloc_list, 1, 16));
  }

  return SRSASN_SUCCESS;
}
SRSASN_CODE pdsch_cfg_common_s::unpack(cbit_ref& bref)
{
  bref.unpack(ext, 1);
  bool pdsch_time_domain_alloc_list_present;
  HANDLE_CODE(bref.unpack(pdsch_time_domain_alloc_list_present, 1));

  if (pdsch_time_domain_alloc_list_present) {
    HANDLE_CODE(unpack_dyn_seq_of(pdsch_time_domain_alloc_list, bref, 1, 16));
  }

  return SRSASN_SUCCESS;
}
void pdsch_cfg_common_s::to_json(json_writer& j) const
{
  j.start_obj();
  if (pdsch_time_domain_alloc_list.size() > 0) {
    j.start_array("pdsch-TimeDomainAllocationList");
    for (const auto& e1 : pdsch_time_domain_alloc_list) {
      e1.to_json(j);
    }
    j.end_array();
  }
  j.end_obj();
}

// PUCCH-ConfigCommon ::= SEQUENCE
SRSASN_CODE pucch_cfg_common_s::pack(bit_ref& bref) const
{
  bref.pack(ext, 1);
  HANDLE_CODE(bref.pack(pucch_res_common_present, 1));
  HANDLE_CODE(bref.pack(hop_id_present, 1));
  HANDLE_CODE(bref.pack(p0_nominal_present, 1));

  if (pucch_res_common_present) {
    HANDLE_CODE(pack_integer(bref, pucch_res_common, (uint8_t)0u, (uint8_t)15u));
  }
  HANDLE_CODE(pucch_group_hop.pack(bref));
  if (hop_id_present) {
    HANDLE_CODE(pack_integer(bref, hop_id, (uint16_t)0u, (uint16_t)1023u));
  }
  if (p0_nominal_present) {
    HANDLE_CODE(pack_integer(bref, p0_nominal, (int16_t)-202, (int16_t)24));
  }

  if (ext) {
    ext_groups_packer_guard group_flags;
    group_flags[0] |= nrof_prbs_present;
    group_flags[0] |= intra_slot_fh_r17_present;
    group_flags[0] |= pucch_res_common_red_cap_r17_present;
    group_flags[0] |= add_prb_offset_r17_present;
    group_flags.pack(bref);

    if (group_flags[0]) {
      varlength_field_pack_guard varlen_scope(bref, false);

      HANDLE_CODE(bref.pack(nrof_prbs_present, 1));
      HANDLE_CODE(bref.pack(intra_slot_fh_r17_present, 1));
      HANDLE_CODE(bref.pack(pucch_res_common_red_cap_r17_present, 1));
      HANDLE_CODE(bref.pack(add_prb_offset_r17_present, 1));
      if (nrof_prbs_present) {
        HANDLE_CODE(pack_integer(bref, nrof_prbs, (uint8_t)1u, (uint8_t)16u));
      }
      if (intra_slot_fh_r17_present) {
        HANDLE_CODE(intra_slot_fh_r17.pack(bref));
      }
      if (pucch_res_common_red_cap_r17_present) {
        HANDLE_CODE(pack_integer(bref, pucch_res_common_red_cap_r17, (uint8_t)0u, (uint8_t)15u));
      }
      if (add_prb_offset_r17_present) {
        HANDLE_CODE(add_prb_offset_r17.pack(bref));
      }
    }
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE pucch_cfg_common_s::unpack(cbit_ref& bref)
{
  bref.unpack(ext, 1);
  HANDLE_CODE(bref.unpack(pucch_res_common_present, 1));
  HANDLE_CODE(bref.unpack(hop_id_present, 1));
  HANDLE_CODE(bref.unpack(p0_nominal_present, 1));

  if (pucch_res_common_present) {
    HANDLE_CODE(unpack_integer(pucch_res_common, bref, (uint8_t)0u, (uint8_t)15u));
  }
  HANDLE_CODE(pucch_group_hop.unpack(bref));
  if (hop_id_present) {
    HANDLE_CODE(unpack_integer(hop_id, bref, (uint16_t)0u, (uint16_t)1023u));
  }
  if (p0_nominal_present) {
    HANDLE_CODE(unpack_integer(p0_nominal, bref, (int16_t)-202, (int16_t)24));
  }

  if (ext) {
    ext_groups_unpacker_guard group_flags(1);
    group_flags.unpack(bref);

    if (group_flags[0]) {
      varlength_field_unpack_guard varlen_scope(bref, false);

      HANDLE_CODE(bref.unpack(nrof_prbs_present, 1));
      HANDLE_CODE(bref.unpack(intra_slot_fh_r17_present, 1));
      HANDLE_CODE(bref.unpack(pucch_res_common_red_cap_r17_present, 1));
      HANDLE_CODE(bref.unpack(add_prb_offset_r17_present, 1));
      if (nrof_prbs_present) {
        HANDLE_CODE(unpack_integer(nrof_prbs, bref, (uint8_t)1u, (uint8_t)16u));
      }
      if (intra_slot_fh_r17_present) {
        HANDLE_CODE(intra_slot_fh_r17.unpack(bref));
      }
      if (pucch_res_common_red_cap_r17_present) {
        HANDLE_CODE(unpack_integer(pucch_res_common_red_cap_r17, bref, (uint8_t)0u, (uint8_t)15u));
      }
      if (add_prb_offset_r17_present) {
        HANDLE_CODE(add_prb_offset_r17.unpack(bref));
      }
    }
  }
  return SRSASN_SUCCESS;
}
void pucch_cfg_common_s::to_json(json_writer& j) const
{
  j.start_obj();
  if (pucch_res_common_present) {
    j.write_int("pucch-ResourceCommon", pucch_res_common);
  }
  j.write_str("pucch-GroupHopping", pucch_group_hop.to_string());
  if (hop_id_present) {
    j.write_int("hoppingId", hop_id);
  }
  if (p0_nominal_present) {
    j.write_int("p0-nominal", p0_nominal);
  }
  if (ext) {
    if (nrof_prbs_present) {
      j.write_int("nrofPRBs", nrof_prbs);
    }
    if (intra_slot_fh_r17_present) {
      j.write_str("intra-SlotFH-r17", intra_slot_fh_r17.to_string());
    }
    if (pucch_res_common_red_cap_r17_present) {
      j.write_int("pucch-ResourceCommonRedCap-r17", pucch_res_common_red_cap_r17);
    }
    if (add_prb_offset_r17_present) {
      j.write_str("additionalPRBOffset-r17", add_prb_offset_r17.to_string());
    }
  }
  j.end_obj();
}

const char* pucch_cfg_common_s::pucch_group_hop_opts::to_string() const
{
  static const char* names[] = {"neither", "enable", "disable"};
  return convert_enum_idx(names, 3, value, "pucch_cfg_common_s::pucch_group_hop_e_");
}

const char* pucch_cfg_common_s::intra_slot_fh_r17_opts::to_string() const
{
  static const char* names[] = {"fromLowerEdge", "fromUpperEdge"};
  return convert_enum_idx(names, 2, value, "pucch_cfg_common_s::intra_slot_fh_r17_e_");
}

const char* pucch_cfg_common_s::add_prb_offset_r17_opts::to_string() const
{
  static const char* names[] = {"n2", "n3", "n4", "n6", "n8", "n9", "n10", "n12"};
  return convert_enum_idx(names, 8, value, "pucch_cfg_common_s::add_prb_offset_r17_e_");
}
uint8_t pucch_cfg_common_s::add_prb_offset_r17_opts::to_number() const
{
  static const uint8_t numbers[] = {2, 3, 4, 6, 8, 9, 10, 12};
  return map_enum_number(numbers, 8, value, "pucch_cfg_common_s::add_prb_offset_r17_e_");
}

// PUSCH-ConfigCommon ::= SEQUENCE
SRSASN_CODE pusch_cfg_common_s::pack(bit_ref& bref) const
{
  bref.pack(ext, 1);
  HANDLE_CODE(bref.pack(group_hop_enabled_transform_precoding_present, 1));
  HANDLE_CODE(bref.pack(pusch_time_domain_alloc_list.size() > 0, 1));
  HANDLE_CODE(bref.pack(msg3_delta_preamb_present, 1));
  HANDLE_CODE(bref.pack(p0_nominal_with_grant_present, 1));

  if (pusch_time_domain_alloc_list.size() > 0) {
    HANDLE_CODE(pack_dyn_seq_of(bref, pusch_time_domain_alloc_list, 1, 16));
  }
  if (msg3_delta_preamb_present) {
    HANDLE_CODE(pack_integer(bref, msg3_delta_preamb, (int8_t)-1, (int8_t)6));
  }
  if (p0_nominal_with_grant_present) {
    HANDLE_CODE(pack_integer(bref, p0_nominal_with_grant, (int16_t)-202, (int16_t)24));
  }

  return SRSASN_SUCCESS;
}
SRSASN_CODE pusch_cfg_common_s::unpack(cbit_ref& bref)
{
  bref.unpack(ext, 1);
  HANDLE_CODE(bref.unpack(group_hop_enabled_transform_precoding_present, 1));
  bool pusch_time_domain_alloc_list_present;
  HANDLE_CODE(bref.unpack(pusch_time_domain_alloc_list_present, 1));
  HANDLE_CODE(bref.unpack(msg3_delta_preamb_present, 1));
  HANDLE_CODE(bref.unpack(p0_nominal_with_grant_present, 1));

  if (pusch_time_domain_alloc_list_present) {
    HANDLE_CODE(unpack_dyn_seq_of(pusch_time_domain_alloc_list, bref, 1, 16));
  }
  if (msg3_delta_preamb_present) {
    HANDLE_CODE(unpack_integer(msg3_delta_preamb, bref, (int8_t)-1, (int8_t)6));
  }
  if (p0_nominal_with_grant_present) {
    HANDLE_CODE(unpack_integer(p0_nominal_with_grant, bref, (int16_t)-202, (int16_t)24));
  }

  return SRSASN_SUCCESS;
}
void pusch_cfg_common_s::to_json(json_writer& j) const
{
  j.start_obj();
  if (group_hop_enabled_transform_precoding_present) {
    j.write_str("groupHoppingEnabledTransformPrecoding", "enabled");
  }
  if (pusch_time_domain_alloc_list.size() > 0) {
    j.start_array("pusch-TimeDomainAllocationList");
    for (const auto& e1 : pusch_time_domain_alloc_list) {
      e1.to_json(j);
    }
    j.end_array();
  }
  if (msg3_delta_preamb_present) {
    j.write_int("msg3-DeltaPreamble", msg3_delta_preamb);
  }
  if (p0_nominal_with_grant_present) {
    j.write_int("p0-NominalWithGrant", p0_nominal_with_grant);
  }
  j.end_obj();
}

// BWP-DownlinkCommon ::= SEQUENCE
SRSASN_CODE bwp_dl_common_s::pack(bit_ref& bref) const
{
  bref.pack(ext, 1);
  HANDLE_CODE(bref.pack(pdcch_cfg_common_present, 1));
  HANDLE_CODE(bref.pack(pdsch_cfg_common_present, 1));

  HANDLE_CODE(generic_params.pack(bref));
  if (pdcch_cfg_common_present) {
    HANDLE_CODE(pdcch_cfg_common.pack(bref));
  }
  if (pdsch_cfg_common_present) {
    HANDLE_CODE(pdsch_cfg_common.pack(bref));
  }

  return SRSASN_SUCCESS;
}
SRSASN_CODE bwp_dl_common_s::unpack(cbit_ref& bref)
{
  bref.unpack(ext, 1);
  HANDLE_CODE(bref.unpack(pdcch_cfg_common_present, 1));
  HANDLE_CODE(bref.unpack(pdsch_cfg_common_present, 1));

  HANDLE_CODE(generic_params.unpack(bref));
  if (pdcch_cfg_common_present) {
    HANDLE_CODE(pdcch_cfg_common.unpack(bref));
  }
  if (pdsch_cfg_common_present) {
    HANDLE_CODE(pdsch_cfg_common.unpack(bref));
  }

  return SRSASN_SUCCESS;
}
void bwp_dl_common_s::to_json(json_writer& j) const
{
  j.start_obj();
  j.write_fieldname("genericParameters");
  generic_params.to_json(j);
  if (pdcch_cfg_common_present) {
    j.write_fieldname("pdcch-ConfigCommon");
    pdcch_cfg_common.to_json(j);
  }
  if (pdsch_cfg_common_present) {
    j.write_fieldname("pdsch-ConfigCommon");
    pdsch_cfg_common.to_json(j);
  }
  j.end_obj();
}

// BWP-UplinkCommon ::= SEQUENCE
SRSASN_CODE bwp_ul_common_s::pack(bit_ref& bref) const
{
  bref.pack(ext, 1);
  HANDLE_CODE(bref.pack(rach_cfg_common_present, 1));
  HANDLE_CODE(bref.pack(pusch_cfg_common_present, 1));
  HANDLE_CODE(bref.pack(pucch_cfg_common_present, 1));

  HANDLE_CODE(generic_params.pack(bref));
  if (rach_cfg_common_present) {
    HANDLE_CODE(rach_cfg_common.pack(bref));
  }
  if (pusch_cfg_common_present) {
    HANDLE_CODE(pusch_cfg_common.pack(bref));
  }
  if (pucch_cfg_common_present) {
    HANDLE_CODE(pucch_cfg_common.pack(bref));
  }

  if (ext) {
    ext_groups_packer_guard group_flags;
    group_flags[0] |= rach_cfg_common_iab_r16.is_present();
    group_flags[0] |= use_interlace_pucch_pusch_r16_present;
    group_flags[0] |= msg_a_cfg_common_r16.is_present();
    group_flags[1] |= enable_ra_prioritization_for_slicing_r17_present;
    group_flags[1] |= add_rach_cfg_list_r17.is_present();
    group_flags[1] |= rsrp_thres_msg3_r17_present;
    group_flags[1] |= nof_msg3_repeats_list_r17.is_present();
    group_flags[1] |= mcs_msg3_repeats_r17.is_present();
    group_flags.pack(bref);

    if (group_flags[0]) {
      varlength_field_pack_guard varlen_scope(bref, false);

      HANDLE_CODE(bref.pack(rach_cfg_common_iab_r16.is_present(), 1));
      HANDLE_CODE(bref.pack(use_interlace_pucch_pusch_r16_present, 1));
      HANDLE_CODE(bref.pack(msg_a_cfg_common_r16.is_present(), 1));
      if (rach_cfg_common_iab_r16.is_present()) {
        HANDLE_CODE(rach_cfg_common_iab_r16->pack(bref));
      }
      if (msg_a_cfg_common_r16.is_present()) {
        HANDLE_CODE(msg_a_cfg_common_r16->pack(bref));
      }
    }
    if (group_flags[1]) {
      varlength_field_pack_guard varlen_scope(bref, false);

      HANDLE_CODE(bref.pack(enable_ra_prioritization_for_slicing_r17_present, 1));
      HANDLE_CODE(bref.pack(add_rach_cfg_list_r17.is_present(), 1));
      HANDLE_CODE(bref.pack(rsrp_thres_msg3_r17_present, 1));
      HANDLE_CODE(bref.pack(nof_msg3_repeats_list_r17.is_present(), 1));
      HANDLE_CODE(bref.pack(mcs_msg3_repeats_r17.is_present(), 1));
      if (enable_ra_prioritization_for_slicing_r17_present) {
        HANDLE_CODE(bref.pack(enable_ra_prioritization_for_slicing_r17, 1));
      }
      if (add_rach_cfg_list_r17.is_present()) {
        HANDLE_CODE(add_rach_cfg_list_r17->pack(bref));
      }
      if (rsrp_thres_msg3_r17_present) {
        HANDLE_CODE(pack_integer(bref, rsrp_thres_msg3_r17, (uint8_t)0u, (uint8_t)127u));
      }
      if (nof_msg3_repeats_list_r17.is_present()) {
        HANDLE_CODE(pack_fixed_seq_of(bref, *nof_msg3_repeats_list_r17, nof_msg3_repeats_list_r17->size()));
      }
      if (mcs_msg3_repeats_r17.is_present()) {
        HANDLE_CODE(pack_fixed_seq_of(
            bref, *mcs_msg3_repeats_r17, mcs_msg3_repeats_r17->size(), integer_packer<uint8_t>(0, 31)));
      }
    }
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE bwp_ul_common_s::unpack(cbit_ref& bref)
{
  bref.unpack(ext, 1);
  HANDLE_CODE(bref.unpack(rach_cfg_common_present, 1));
  HANDLE_CODE(bref.unpack(pusch_cfg_common_present, 1));
  HANDLE_CODE(bref.unpack(pucch_cfg_common_present, 1));

  HANDLE_CODE(generic_params.unpack(bref));
  if (rach_cfg_common_present) {
    HANDLE_CODE(rach_cfg_common.unpack(bref));
  }
  if (pusch_cfg_common_present) {
    HANDLE_CODE(pusch_cfg_common.unpack(bref));
  }
  if (pucch_cfg_common_present) {
    HANDLE_CODE(pucch_cfg_common.unpack(bref));
  }

  if (ext) {
    ext_groups_unpacker_guard group_flags(2);
    group_flags.unpack(bref);

    if (group_flags[0]) {
      varlength_field_unpack_guard varlen_scope(bref, false);

      unpack_presence_flag(rach_cfg_common_iab_r16, bref);
      HANDLE_CODE(bref.unpack(use_interlace_pucch_pusch_r16_present, 1));
      unpack_presence_flag(msg_a_cfg_common_r16, bref);
      if (rach_cfg_common_iab_r16.is_present()) {
        HANDLE_CODE(rach_cfg_common_iab_r16->unpack(bref));
      }
      if (msg_a_cfg_common_r16.is_present()) {
        HANDLE_CODE(msg_a_cfg_common_r16->unpack(bref));
      }
    }
    if (group_flags[1]) {
      varlength_field_unpack_guard varlen_scope(bref, false);

      HANDLE_CODE(bref.unpack(enable_ra_prioritization_for_slicing_r17_present, 1));
      unpack_presence_flag(add_rach_cfg_list_r17, bref);
      HANDLE_CODE(bref.unpack(rsrp_thres_msg3_r17_present, 1));
      unpack_presence_flag(nof_msg3_repeats_list_r17, bref);
      unpack_presence_flag(mcs_msg3_repeats_r17, bref);
      if (enable_ra_prioritization_for_slicing_r17_present) {
        HANDLE_CODE(bref.unpack(enable_ra_prioritization_for_slicing_r17, 1));
      }
      if (add_rach_cfg_list_r17.is_present()) {
        HANDLE_CODE(add_rach_cfg_list_r17->unpack(bref));
      }
      if (rsrp_thres_msg3_r17_present) {
        HANDLE_CODE(unpack_integer(rsrp_thres_msg3_r17, bref, (uint8_t)0u, (uint8_t)127u));
      }
      if (nof_msg3_repeats_list_r17.is_present()) {
        HANDLE_CODE(unpack_fixed_seq_of(*nof_msg3_repeats_list_r17, bref, nof_msg3_repeats_list_r17->size()));
      }
      if (mcs_msg3_repeats_r17.is_present()) {
        HANDLE_CODE(unpack_fixed_seq_of(
            *mcs_msg3_repeats_r17, bref, mcs_msg3_repeats_r17->size(), integer_packer<uint8_t>(0, 31)));
      }
    }
  }
  return SRSASN_SUCCESS;
}
void bwp_ul_common_s::to_json(json_writer& j) const
{
  j.start_obj();
  j.write_fieldname("genericParameters");
  generic_params.to_json(j);
  if (rach_cfg_common_present) {
    j.write_fieldname("rach-ConfigCommon");
    rach_cfg_common.to_json(j);
  }
  if (pusch_cfg_common_present) {
    j.write_fieldname("pusch-ConfigCommon");
    pusch_cfg_common.to_json(j);
  }
  if (pucch_cfg_common_present) {
    j.write_fieldname("pucch-ConfigCommon");
    pucch_cfg_common.to_json(j);
  }
  if (ext) {
    if (rach_cfg_common_iab_r16.is_present()) {
      j.write_fieldname("rach-ConfigCommonIAB-r16");
      rach_cfg_common_iab_r16->to_json(j);
    }
    if (use_interlace_pucch_pusch_r16_present) {
      j.write_str("useInterlacePUCCH-PUSCH-r16", "enabled");
    }
    if (msg_a_cfg_common_r16.is_present()) {
      j.write_fieldname("msgA-ConfigCommon-r16");
      msg_a_cfg_common_r16->to_json(j);
    }
    if (enable_ra_prioritization_for_slicing_r17_present) {
      j.write_bool("enableRA-PrioritizationForSlicing-r17", enable_ra_prioritization_for_slicing_r17);
    }
    if (add_rach_cfg_list_r17.is_present()) {
      j.write_fieldname("additionalRACH-ConfigList-r17");
      add_rach_cfg_list_r17->to_json(j);
    }
    if (rsrp_thres_msg3_r17_present) {
      j.write_int("rsrp-ThresholdMsg3-r17", rsrp_thres_msg3_r17);
    }
    if (nof_msg3_repeats_list_r17.is_present()) {
      j.start_array("numberOfMsg3-RepetitionsList-r17");
      for (const auto& e1 : *nof_msg3_repeats_list_r17) {
        j.write_str(e1.to_string());
      }
      j.end_array();
    }
    if (mcs_msg3_repeats_r17.is_present()) {
      j.start_array("mcs-Msg3-Repetitions-r17");
      for (const auto& e1 : *mcs_msg3_repeats_r17) {
        j.write_int(e1);
      }
      j.end_array();
    }
  }
  j.end_obj();
}

// NonCellDefiningSSB-r17 ::= SEQUENCE
SRSASN_CODE non_cell_defining_ssb_r17_s::pack(bit_ref& bref) const
{
  bref.pack(ext, 1);
  HANDLE_CODE(bref.pack(ssb_periodicity_r17_present, 1));
  HANDLE_CODE(bref.pack(ssb_time_offset_r17_present, 1));

  HANDLE_CODE(pack_integer(bref, absolute_freq_ssb_r17, (uint32_t)0u, (uint32_t)3279165u));
  if (ssb_periodicity_r17_present) {
    HANDLE_CODE(ssb_periodicity_r17.pack(bref));
  }
  if (ssb_time_offset_r17_present) {
    HANDLE_CODE(ssb_time_offset_r17.pack(bref));
  }

  return SRSASN_SUCCESS;
}
SRSASN_CODE non_cell_defining_ssb_r17_s::unpack(cbit_ref& bref)
{
  bref.unpack(ext, 1);
  HANDLE_CODE(bref.unpack(ssb_periodicity_r17_present, 1));
  HANDLE_CODE(bref.unpack(ssb_time_offset_r17_present, 1));

  HANDLE_CODE(unpack_integer(absolute_freq_ssb_r17, bref, (uint32_t)0u, (uint32_t)3279165u));
  if (ssb_periodicity_r17_present) {
    HANDLE_CODE(ssb_periodicity_r17.unpack(bref));
  }
  if (ssb_time_offset_r17_present) {
    HANDLE_CODE(ssb_time_offset_r17.unpack(bref));
  }

  return SRSASN_SUCCESS;
}
void non_cell_defining_ssb_r17_s::to_json(json_writer& j) const
{
  j.start_obj();
  j.write_int("absoluteFrequencySSB-r17", absolute_freq_ssb_r17);
  if (ssb_periodicity_r17_present) {
    j.write_str("ssb-Periodicity-r17", ssb_periodicity_r17.to_string());
  }
  if (ssb_time_offset_r17_present) {
    j.write_str("ssb-TimeOffset-r17", ssb_time_offset_r17.to_string());
  }
  j.end_obj();
}

const char* non_cell_defining_ssb_r17_s::ssb_periodicity_r17_opts::to_string() const
{
  static const char* names[] = {"ms5", "ms10", "ms20", "ms40", "ms80", "ms160", "spare2", "spare1"};
  return convert_enum_idx(names, 8, value, "non_cell_defining_ssb_r17_s::ssb_periodicity_r17_e_");
}
uint8_t non_cell_defining_ssb_r17_s::ssb_periodicity_r17_opts::to_number() const
{
  static const uint8_t numbers[] = {5, 10, 20, 40, 80, 160};
  return map_enum_number(numbers, 6, value, "non_cell_defining_ssb_r17_s::ssb_periodicity_r17_e_");
}

const char* non_cell_defining_ssb_r17_s::ssb_time_offset_r17_opts::to_string() const
{
  static const char* names[] = {"ms5", "ms10", "ms15", "ms20", "ms40", "ms80", "spare2", "spare1"};
  return convert_enum_idx(names, 8, value, "non_cell_defining_ssb_r17_s::ssb_time_offset_r17_e_");
}
uint8_t non_cell_defining_ssb_r17_s::ssb_time_offset_r17_opts::to_number() const
{
  static const uint8_t numbers[] = {5, 10, 15, 20, 40, 80};
  return map_enum_number(numbers, 6, value, "non_cell_defining_ssb_r17_s::ssb_time_offset_r17_e_");
}

// BFR-CSIRS-Resource ::= SEQUENCE
SRSASN_CODE bfr_csi_rs_res_s::pack(bit_ref& bref) const
{
  bref.pack(ext, 1);
  HANDLE_CODE(bref.pack(ra_occasion_list.size() > 0, 1));
  HANDLE_CODE(bref.pack(ra_preamb_idx_present, 1));

  HANDLE_CODE(pack_integer(bref, csi_rs, (uint8_t)0u, (uint8_t)191u));
  if (ra_occasion_list.size() > 0) {
    HANDLE_CODE(pack_dyn_seq_of(bref, ra_occasion_list, 1, 64, integer_packer<uint16_t>(0, 511)));
  }
  if (ra_preamb_idx_present) {
    HANDLE_CODE(pack_integer(bref, ra_preamb_idx, (uint8_t)0u, (uint8_t)63u));
  }

  return SRSASN_SUCCESS;
}
SRSASN_CODE bfr_csi_rs_res_s::unpack(cbit_ref& bref)
{
  bref.unpack(ext, 1);
  bool ra_occasion_list_present;
  HANDLE_CODE(bref.unpack(ra_occasion_list_present, 1));
  HANDLE_CODE(bref.unpack(ra_preamb_idx_present, 1));

  HANDLE_CODE(unpack_integer(csi_rs, bref, (uint8_t)0u, (uint8_t)191u));
  if (ra_occasion_list_present) {
    HANDLE_CODE(unpack_dyn_seq_of(ra_occasion_list, bref, 1, 64, integer_packer<uint16_t>(0, 511)));
  }
  if (ra_preamb_idx_present) {
    HANDLE_CODE(unpack_integer(ra_preamb_idx, bref, (uint8_t)0u, (uint8_t)63u));
  }

  return SRSASN_SUCCESS;
}
void bfr_csi_rs_res_s::to_json(json_writer& j) const
{
  j.start_obj();
  j.write_int("csi-RS", csi_rs);
  if (ra_occasion_list.size() > 0) {
    j.start_array("ra-OccasionList");
    for (const auto& e1 : ra_occasion_list) {
      j.write_int(e1);
    }
    j.end_array();
  }
  if (ra_preamb_idx_present) {
    j.write_int("ra-PreambleIndex", ra_preamb_idx);
  }
  j.end_obj();
}

// BFR-SSB-Resource ::= SEQUENCE
SRSASN_CODE bfr_ssb_res_s::pack(bit_ref& bref) const
{
  bref.pack(ext, 1);
  HANDLE_CODE(pack_integer(bref, ssb, (uint8_t)0u, (uint8_t)63u));
  HANDLE_CODE(pack_integer(bref, ra_preamb_idx, (uint8_t)0u, (uint8_t)63u));

  return SRSASN_SUCCESS;
}
SRSASN_CODE bfr_ssb_res_s::unpack(cbit_ref& bref)
{
  bref.unpack(ext, 1);
  HANDLE_CODE(unpack_integer(ssb, bref, (uint8_t)0u, (uint8_t)63u));
  HANDLE_CODE(unpack_integer(ra_preamb_idx, bref, (uint8_t)0u, (uint8_t)63u));

  return SRSASN_SUCCESS;
}
void bfr_ssb_res_s::to_json(json_writer& j) const
{
  j.start_obj();
  j.write_int("ssb", ssb);
  j.write_int("ra-PreambleIndex", ra_preamb_idx);
  j.end_obj();
}

// CSI-FrequencyOccupation ::= SEQUENCE
SRSASN_CODE csi_freq_occupation_s::pack(bit_ref& bref) const
{
  bref.pack(ext, 1);
  HANDLE_CODE(pack_integer(bref, start_rb, (uint16_t)0u, (uint16_t)274u));
  HANDLE_CODE(pack_integer(bref, nrof_rbs, (uint16_t)24u, (uint16_t)276u));

  return SRSASN_SUCCESS;
}
SRSASN_CODE csi_freq_occupation_s::unpack(cbit_ref& bref)
{
  bref.unpack(ext, 1);
  HANDLE_CODE(unpack_integer(start_rb, bref, (uint16_t)0u, (uint16_t)274u));
  HANDLE_CODE(unpack_integer(nrof_rbs, bref, (uint16_t)24u, (uint16_t)276u));

  return SRSASN_SUCCESS;
}
void csi_freq_occupation_s::to_json(json_writer& j) const
{
  j.start_obj();
  j.write_int("startingRB", start_rb);
  j.write_int("nrofRBs", nrof_rbs);
  j.end_obj();
}

// BeamLinkMonitoringRS-r17 ::= SEQUENCE
SRSASN_CODE beam_link_monitoring_rs_r17_s::pack(bit_ref& bref) const
{
  bref.pack(ext, 1);
  HANDLE_CODE(pack_integer(bref, beam_link_monitoring_rs_id_r17, (uint8_t)0u, (uint8_t)63u));
  HANDLE_CODE(detection_res_r17.pack(bref));

  return SRSASN_SUCCESS;
}
SRSASN_CODE beam_link_monitoring_rs_r17_s::unpack(cbit_ref& bref)
{
  bref.unpack(ext, 1);
  HANDLE_CODE(unpack_integer(beam_link_monitoring_rs_id_r17, bref, (uint8_t)0u, (uint8_t)63u));
  HANDLE_CODE(detection_res_r17.unpack(bref));

  return SRSASN_SUCCESS;
}
void beam_link_monitoring_rs_r17_s::to_json(json_writer& j) const
{
  j.start_obj();
  j.write_int("beamLinkMonitoringRS-Id-r17", beam_link_monitoring_rs_id_r17);
  j.write_fieldname("detectionResource-r17");
  detection_res_r17.to_json(j);
  j.end_obj();
}

void beam_link_monitoring_rs_r17_s::detection_res_r17_c_::destroy_() {}
void beam_link_monitoring_rs_r17_s::detection_res_r17_c_::set(types::options e)
{
  destroy_();
  type_ = e;
}
beam_link_monitoring_rs_r17_s::detection_res_r17_c_::detection_res_r17_c_(
    const beam_link_monitoring_rs_r17_s::detection_res_r17_c_& other)
{
  type_ = other.type();
  switch (type_) {
    case types::ssb_idx:
      c.init(other.c.get<uint8_t>());
      break;
    case types::csi_rs_idx:
      c.init(other.c.get<uint8_t>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "beam_link_monitoring_rs_r17_s::detection_res_r17_c_");
  }
}
beam_link_monitoring_rs_r17_s::detection_res_r17_c_& beam_link_monitoring_rs_r17_s::detection_res_r17_c_::operator=(
    const beam_link_monitoring_rs_r17_s::detection_res_r17_c_& other)
{
  if (this == &other) {
    return *this;
  }
  set(other.type());
  switch (type_) {
    case types::ssb_idx:
      c.set(other.c.get<uint8_t>());
      break;
    case types::csi_rs_idx:
      c.set(other.c.get<uint8_t>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "beam_link_monitoring_rs_r17_s::detection_res_r17_c_");
  }

  return *this;
}
uint8_t& beam_link_monitoring_rs_r17_s::detection_res_r17_c_::set_ssb_idx()
{
  set(types::ssb_idx);
  return c.get<uint8_t>();
}
uint8_t& beam_link_monitoring_rs_r17_s::detection_res_r17_c_::set_csi_rs_idx()
{
  set(types::csi_rs_idx);
  return c.get<uint8_t>();
}
void beam_link_monitoring_rs_r17_s::detection_res_r17_c_::to_json(json_writer& j) const
{
  j.start_obj();
  switch (type_) {
    case types::ssb_idx:
      j.write_int("ssb-Index", c.get<uint8_t>());
      break;
    case types::csi_rs_idx:
      j.write_int("csi-RS-Index", c.get<uint8_t>());
      break;
    default:
      log_invalid_choice_id(type_, "beam_link_monitoring_rs_r17_s::detection_res_r17_c_");
  }
  j.end_obj();
}
SRSASN_CODE beam_link_monitoring_rs_r17_s::detection_res_r17_c_::pack(bit_ref& bref) const
{
  type_.pack(bref);
  switch (type_) {
    case types::ssb_idx:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)63u));
      break;
    case types::csi_rs_idx:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)191u));
      break;
    default:
      log_invalid_choice_id(type_, "beam_link_monitoring_rs_r17_s::detection_res_r17_c_");
      return SRSASN_ERROR_ENCODE_FAIL;
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE beam_link_monitoring_rs_r17_s::detection_res_r17_c_::unpack(cbit_ref& bref)
{
  types e;
  e.unpack(bref);
  set(e);
  switch (type_) {
    case types::ssb_idx:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)63u));
      break;
    case types::csi_rs_idx:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)191u));
      break;
    default:
      log_invalid_choice_id(type_, "beam_link_monitoring_rs_r17_s::detection_res_r17_c_");
      return SRSASN_ERROR_DECODE_FAIL;
  }
  return SRSASN_SUCCESS;
}

const char* beam_link_monitoring_rs_r17_s::detection_res_r17_c_::types_opts::to_string() const
{
  static const char* names[] = {"ssb-Index", "csi-RS-Index"};
  return convert_enum_idx(names, 2, value, "beam_link_monitoring_rs_r17_s::detection_res_r17_c_::types");
}

// CI-ConfigurationPerServingCell-r16 ::= SEQUENCE
SRSASN_CODE ci_cfg_per_serving_cell_r16_s::pack(bit_ref& bref) const
{
  HANDLE_CODE(bref.pack(position_in_dci_for_sul_r16_present, 1));
  HANDLE_CODE(bref.pack(ul_cancellation_prio_v1610_present, 1));

  HANDLE_CODE(pack_integer(bref, serving_cell_id, (uint8_t)0u, (uint8_t)31u));
  HANDLE_CODE(pack_integer(bref, position_in_dci_r16, (uint8_t)0u, (uint8_t)125u));
  if (position_in_dci_for_sul_r16_present) {
    HANDLE_CODE(pack_integer(bref, position_in_dci_for_sul_r16, (uint8_t)0u, (uint8_t)125u));
  }
  HANDLE_CODE(ci_payload_size_r16.pack(bref));
  bref.pack(time_freq_region_r16.ext, 1);
  HANDLE_CODE(bref.pack(time_freq_region_r16.time_dur_for_ci_r16_present, 1));
  if (time_freq_region_r16.time_dur_for_ci_r16_present) {
    HANDLE_CODE(time_freq_region_r16.time_dur_for_ci_r16.pack(bref));
  }
  HANDLE_CODE(time_freq_region_r16.time_granularity_for_ci_r16.pack(bref));
  HANDLE_CODE(pack_integer(bref, time_freq_region_r16.freq_region_for_ci_r16, (uint16_t)0u, (uint16_t)37949u));
  HANDLE_CODE(pack_integer(bref, time_freq_region_r16.delta_offset_r16, (uint8_t)0u, (uint8_t)2u));

  return SRSASN_SUCCESS;
}
SRSASN_CODE ci_cfg_per_serving_cell_r16_s::unpack(cbit_ref& bref)
{
  HANDLE_CODE(bref.unpack(position_in_dci_for_sul_r16_present, 1));
  HANDLE_CODE(bref.unpack(ul_cancellation_prio_v1610_present, 1));

  HANDLE_CODE(unpack_integer(serving_cell_id, bref, (uint8_t)0u, (uint8_t)31u));
  HANDLE_CODE(unpack_integer(position_in_dci_r16, bref, (uint8_t)0u, (uint8_t)125u));
  if (position_in_dci_for_sul_r16_present) {
    HANDLE_CODE(unpack_integer(position_in_dci_for_sul_r16, bref, (uint8_t)0u, (uint8_t)125u));
  }
  HANDLE_CODE(ci_payload_size_r16.unpack(bref));
  bref.unpack(time_freq_region_r16.ext, 1);
  HANDLE_CODE(bref.unpack(time_freq_region_r16.time_dur_for_ci_r16_present, 1));
  if (time_freq_region_r16.time_dur_for_ci_r16_present) {
    HANDLE_CODE(time_freq_region_r16.time_dur_for_ci_r16.unpack(bref));
  }
  HANDLE_CODE(time_freq_region_r16.time_granularity_for_ci_r16.unpack(bref));
  HANDLE_CODE(unpack_integer(time_freq_region_r16.freq_region_for_ci_r16, bref, (uint16_t)0u, (uint16_t)37949u));
  HANDLE_CODE(unpack_integer(time_freq_region_r16.delta_offset_r16, bref, (uint8_t)0u, (uint8_t)2u));

  return SRSASN_SUCCESS;
}
void ci_cfg_per_serving_cell_r16_s::to_json(json_writer& j) const
{
  j.start_obj();
  j.write_int("servingCellId", serving_cell_id);
  j.write_int("positionInDCI-r16", position_in_dci_r16);
  if (position_in_dci_for_sul_r16_present) {
    j.write_int("positionInDCI-ForSUL-r16", position_in_dci_for_sul_r16);
  }
  j.write_str("ci-PayloadSize-r16", ci_payload_size_r16.to_string());
  j.write_fieldname("timeFrequencyRegion-r16");
  j.start_obj();
  if (time_freq_region_r16.time_dur_for_ci_r16_present) {
    j.write_str("timeDurationForCI-r16", time_freq_region_r16.time_dur_for_ci_r16.to_string());
  }
  j.write_str("timeGranularityForCI-r16", time_freq_region_r16.time_granularity_for_ci_r16.to_string());
  j.write_int("frequencyRegionForCI-r16", time_freq_region_r16.freq_region_for_ci_r16);
  j.write_int("deltaOffset-r16", time_freq_region_r16.delta_offset_r16);
  j.end_obj();
  if (ul_cancellation_prio_v1610_present) {
    j.write_str("uplinkCancellationPriority-v1610", "enabled");
  }
  j.end_obj();
}

const char* ci_cfg_per_serving_cell_r16_s::ci_payload_size_r16_opts::to_string() const
{
  static const char* names[] = {
      "n1", "n2", "n4", "n5", "n7", "n8", "n10", "n14", "n16", "n20", "n28", "n32", "n35", "n42", "n56", "n112"};
  return convert_enum_idx(names, 16, value, "ci_cfg_per_serving_cell_r16_s::ci_payload_size_r16_e_");
}
uint8_t ci_cfg_per_serving_cell_r16_s::ci_payload_size_r16_opts::to_number() const
{
  static const uint8_t numbers[] = {1, 2, 4, 5, 7, 8, 10, 14, 16, 20, 28, 32, 35, 42, 56, 112};
  return map_enum_number(numbers, 16, value, "ci_cfg_per_serving_cell_r16_s::ci_payload_size_r16_e_");
}

const char* ci_cfg_per_serving_cell_r16_s::time_freq_region_r16_s_::time_dur_for_ci_r16_opts::to_string() const
{
  static const char* names[] = {"n2", "n4", "n7", "n14"};
  return convert_enum_idx(
      names, 4, value, "ci_cfg_per_serving_cell_r16_s::time_freq_region_r16_s_::time_dur_for_ci_r16_e_");
}
uint8_t ci_cfg_per_serving_cell_r16_s::time_freq_region_r16_s_::time_dur_for_ci_r16_opts::to_number() const
{
  static const uint8_t numbers[] = {2, 4, 7, 14};
  return map_enum_number(
      numbers, 4, value, "ci_cfg_per_serving_cell_r16_s::time_freq_region_r16_s_::time_dur_for_ci_r16_e_");
}

const char* ci_cfg_per_serving_cell_r16_s::time_freq_region_r16_s_::time_granularity_for_ci_r16_opts::to_string() const
{
  static const char* names[] = {"n1", "n2", "n4", "n7", "n14", "n28"};
  return convert_enum_idx(
      names, 6, value, "ci_cfg_per_serving_cell_r16_s::time_freq_region_r16_s_::time_granularity_for_ci_r16_e_");
}
uint8_t ci_cfg_per_serving_cell_r16_s::time_freq_region_r16_s_::time_granularity_for_ci_r16_opts::to_number() const
{
  static const uint8_t numbers[] = {1, 2, 4, 7, 14, 28};
  return map_enum_number(
      numbers, 6, value, "ci_cfg_per_serving_cell_r16_s::time_freq_region_r16_s_::time_granularity_for_ci_r16_e_");
}

// CSI-RS-ResourceMapping ::= SEQUENCE
SRSASN_CODE csi_rs_res_map_s::pack(bit_ref& bref) const
{
  bref.pack(ext, 1);
  HANDLE_CODE(bref.pack(first_ofdm_symbol_in_time_domain2_present, 1));

  HANDLE_CODE(freq_domain_alloc.pack(bref));
  HANDLE_CODE(nrof_ports.pack(bref));
  HANDLE_CODE(pack_integer(bref, first_ofdm_symbol_in_time_domain, (uint8_t)0u, (uint8_t)13u));
  if (first_ofdm_symbol_in_time_domain2_present) {
    HANDLE_CODE(pack_integer(bref, first_ofdm_symbol_in_time_domain2, (uint8_t)2u, (uint8_t)12u));
  }
  HANDLE_CODE(cdm_type.pack(bref));
  HANDLE_CODE(density.pack(bref));
  HANDLE_CODE(freq_band.pack(bref));

  return SRSASN_SUCCESS;
}
SRSASN_CODE csi_rs_res_map_s::unpack(cbit_ref& bref)
{
  bref.unpack(ext, 1);
  HANDLE_CODE(bref.unpack(first_ofdm_symbol_in_time_domain2_present, 1));

  HANDLE_CODE(freq_domain_alloc.unpack(bref));
  HANDLE_CODE(nrof_ports.unpack(bref));
  HANDLE_CODE(unpack_integer(first_ofdm_symbol_in_time_domain, bref, (uint8_t)0u, (uint8_t)13u));
  if (first_ofdm_symbol_in_time_domain2_present) {
    HANDLE_CODE(unpack_integer(first_ofdm_symbol_in_time_domain2, bref, (uint8_t)2u, (uint8_t)12u));
  }
  HANDLE_CODE(cdm_type.unpack(bref));
  HANDLE_CODE(density.unpack(bref));
  HANDLE_CODE(freq_band.unpack(bref));

  return SRSASN_SUCCESS;
}
void csi_rs_res_map_s::to_json(json_writer& j) const
{
  j.start_obj();
  j.write_fieldname("frequencyDomainAllocation");
  freq_domain_alloc.to_json(j);
  j.write_str("nrofPorts", nrof_ports.to_string());
  j.write_int("firstOFDMSymbolInTimeDomain", first_ofdm_symbol_in_time_domain);
  if (first_ofdm_symbol_in_time_domain2_present) {
    j.write_int("firstOFDMSymbolInTimeDomain2", first_ofdm_symbol_in_time_domain2);
  }
  j.write_str("cdm-Type", cdm_type.to_string());
  j.write_fieldname("density");
  density.to_json(j);
  j.write_fieldname("freqBand");
  freq_band.to_json(j);
  j.end_obj();
}

void csi_rs_res_map_s::freq_domain_alloc_c_::destroy_()
{
  switch (type_) {
    case types::row1:
      c.destroy<fixed_bitstring<4>>();
      break;
    case types::row2:
      c.destroy<fixed_bitstring<12>>();
      break;
    case types::row4:
      c.destroy<fixed_bitstring<3>>();
      break;
    case types::other:
      c.destroy<fixed_bitstring<6>>();
      break;
    default:
      break;
  }
}
void csi_rs_res_map_s::freq_domain_alloc_c_::set(types::options e)
{
  destroy_();
  type_ = e;
  switch (type_) {
    case types::row1:
      c.init<fixed_bitstring<4>>();
      break;
    case types::row2:
      c.init<fixed_bitstring<12>>();
      break;
    case types::row4:
      c.init<fixed_bitstring<3>>();
      break;
    case types::other:
      c.init<fixed_bitstring<6>>();
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "csi_rs_res_map_s::freq_domain_alloc_c_");
  }
}
csi_rs_res_map_s::freq_domain_alloc_c_::freq_domain_alloc_c_(const csi_rs_res_map_s::freq_domain_alloc_c_& other)
{
  type_ = other.type();
  switch (type_) {
    case types::row1:
      c.init(other.c.get<fixed_bitstring<4>>());
      break;
    case types::row2:
      c.init(other.c.get<fixed_bitstring<12>>());
      break;
    case types::row4:
      c.init(other.c.get<fixed_bitstring<3>>());
      break;
    case types::other:
      c.init(other.c.get<fixed_bitstring<6>>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "csi_rs_res_map_s::freq_domain_alloc_c_");
  }
}
csi_rs_res_map_s::freq_domain_alloc_c_&
csi_rs_res_map_s::freq_domain_alloc_c_::operator=(const csi_rs_res_map_s::freq_domain_alloc_c_& other)
{
  if (this == &other) {
    return *this;
  }
  set(other.type());
  switch (type_) {
    case types::row1:
      c.set(other.c.get<fixed_bitstring<4>>());
      break;
    case types::row2:
      c.set(other.c.get<fixed_bitstring<12>>());
      break;
    case types::row4:
      c.set(other.c.get<fixed_bitstring<3>>());
      break;
    case types::other:
      c.set(other.c.get<fixed_bitstring<6>>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "csi_rs_res_map_s::freq_domain_alloc_c_");
  }

  return *this;
}
fixed_bitstring<4>& csi_rs_res_map_s::freq_domain_alloc_c_::set_row1()
{
  set(types::row1);
  return c.get<fixed_bitstring<4>>();
}
fixed_bitstring<12>& csi_rs_res_map_s::freq_domain_alloc_c_::set_row2()
{
  set(types::row2);
  return c.get<fixed_bitstring<12>>();
}
fixed_bitstring<3>& csi_rs_res_map_s::freq_domain_alloc_c_::set_row4()
{
  set(types::row4);
  return c.get<fixed_bitstring<3>>();
}
fixed_bitstring<6>& csi_rs_res_map_s::freq_domain_alloc_c_::set_other()
{
  set(types::other);
  return c.get<fixed_bitstring<6>>();
}
void csi_rs_res_map_s::freq_domain_alloc_c_::to_json(json_writer& j) const
{
  j.start_obj();
  switch (type_) {
    case types::row1:
      j.write_str("row1", c.get<fixed_bitstring<4>>().to_string());
      break;
    case types::row2:
      j.write_str("row2", c.get<fixed_bitstring<12>>().to_string());
      break;
    case types::row4:
      j.write_str("row4", c.get<fixed_bitstring<3>>().to_string());
      break;
    case types::other:
      j.write_str("other", c.get<fixed_bitstring<6>>().to_string());
      break;
    default:
      log_invalid_choice_id(type_, "csi_rs_res_map_s::freq_domain_alloc_c_");
  }
  j.end_obj();
}
SRSASN_CODE csi_rs_res_map_s::freq_domain_alloc_c_::pack(bit_ref& bref) const
{
  type_.pack(bref);
  switch (type_) {
    case types::row1:
      HANDLE_CODE(c.get<fixed_bitstring<4>>().pack(bref));
      break;
    case types::row2:
      HANDLE_CODE(c.get<fixed_bitstring<12>>().pack(bref));
      break;
    case types::row4:
      HANDLE_CODE(c.get<fixed_bitstring<3>>().pack(bref));
      break;
    case types::other:
      HANDLE_CODE(c.get<fixed_bitstring<6>>().pack(bref));
      break;
    default:
      log_invalid_choice_id(type_, "csi_rs_res_map_s::freq_domain_alloc_c_");
      return SRSASN_ERROR_ENCODE_FAIL;
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE csi_rs_res_map_s::freq_domain_alloc_c_::unpack(cbit_ref& bref)
{
  types e;
  e.unpack(bref);
  set(e);
  switch (type_) {
    case types::row1:
      HANDLE_CODE(c.get<fixed_bitstring<4>>().unpack(bref));
      break;
    case types::row2:
      HANDLE_CODE(c.get<fixed_bitstring<12>>().unpack(bref));
      break;
    case types::row4:
      HANDLE_CODE(c.get<fixed_bitstring<3>>().unpack(bref));
      break;
    case types::other:
      HANDLE_CODE(c.get<fixed_bitstring<6>>().unpack(bref));
      break;
    default:
      log_invalid_choice_id(type_, "csi_rs_res_map_s::freq_domain_alloc_c_");
      return SRSASN_ERROR_DECODE_FAIL;
  }
  return SRSASN_SUCCESS;
}

const char* csi_rs_res_map_s::freq_domain_alloc_c_::types_opts::to_string() const
{
  static const char* names[] = {"row1", "row2", "row4", "other"};
  return convert_enum_idx(names, 4, value, "csi_rs_res_map_s::freq_domain_alloc_c_::types");
}
uint8_t csi_rs_res_map_s::freq_domain_alloc_c_::types_opts::to_number() const
{
  static const uint8_t numbers[] = {1, 2, 4};
  return map_enum_number(numbers, 3, value, "csi_rs_res_map_s::freq_domain_alloc_c_::types");
}

const char* csi_rs_res_map_s::nrof_ports_opts::to_string() const
{
  static const char* names[] = {"p1", "p2", "p4", "p8", "p12", "p16", "p24", "p32"};
  return convert_enum_idx(names, 8, value, "csi_rs_res_map_s::nrof_ports_e_");
}
uint8_t csi_rs_res_map_s::nrof_ports_opts::to_number() const
{
  static const uint8_t numbers[] = {1, 2, 4, 8, 12, 16, 24, 32};
  return map_enum_number(numbers, 8, value, "csi_rs_res_map_s::nrof_ports_e_");
}

const char* csi_rs_res_map_s::cdm_type_opts::to_string() const
{
  static const char* names[] = {"noCDM", "fd-CDM2", "cdm4-FD2-TD2", "cdm8-FD2-TD4"};
  return convert_enum_idx(names, 4, value, "csi_rs_res_map_s::cdm_type_e_");
}
uint8_t csi_rs_res_map_s::cdm_type_opts::to_number() const
{
  switch (value) {
    case fd_cdm2:
      return 2;
    case cdm4_fd2_td2:
      return 4;
    case cdm8_fd2_td4:
      return 8;
    default:
      invalid_enum_number(value, "csi_rs_res_map_s::cdm_type_e_");
  }
  return 0;
}

void csi_rs_res_map_s::density_c_::set(types::options e)
{
  type_ = e;
}
csi_rs_res_map_s::density_c_::dot5_e_& csi_rs_res_map_s::density_c_::set_dot5()
{
  set(types::dot5);
  return c;
}
void csi_rs_res_map_s::density_c_::set_one()
{
  set(types::one);
}
void csi_rs_res_map_s::density_c_::set_three()
{
  set(types::three);
}
void csi_rs_res_map_s::density_c_::set_spare()
{
  set(types::spare);
}
void csi_rs_res_map_s::density_c_::to_json(json_writer& j) const
{
  j.start_obj();
  switch (type_) {
    case types::dot5:
      j.write_str("dot5", c.to_string());
      break;
    case types::one:
      break;
    case types::three:
      break;
    case types::spare:
      break;
    default:
      log_invalid_choice_id(type_, "csi_rs_res_map_s::density_c_");
  }
  j.end_obj();
}
SRSASN_CODE csi_rs_res_map_s::density_c_::pack(bit_ref& bref) const
{
  type_.pack(bref);
  switch (type_) {
    case types::dot5:
      HANDLE_CODE(c.pack(bref));
      break;
    case types::one:
      break;
    case types::three:
      break;
    case types::spare:
      break;
    default:
      log_invalid_choice_id(type_, "csi_rs_res_map_s::density_c_");
      return SRSASN_ERROR_ENCODE_FAIL;
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE csi_rs_res_map_s::density_c_::unpack(cbit_ref& bref)
{
  types e;
  e.unpack(bref);
  set(e);
  switch (type_) {
    case types::dot5:
      HANDLE_CODE(c.unpack(bref));
      break;
    case types::one:
      break;
    case types::three:
      break;
    case types::spare:
      break;
    default:
      log_invalid_choice_id(type_, "csi_rs_res_map_s::density_c_");
      return SRSASN_ERROR_DECODE_FAIL;
  }
  return SRSASN_SUCCESS;
}

const char* csi_rs_res_map_s::density_c_::dot5_opts::to_string() const
{
  static const char* names[] = {"evenPRBs", "oddPRBs"};
  return convert_enum_idx(names, 2, value, "csi_rs_res_map_s::density_c_::dot5_e_");
}

const char* csi_rs_res_map_s::density_c_::types_opts::to_string() const
{
  static const char* names[] = {"dot5", "one", "three", "spare"};
  return convert_enum_idx(names, 4, value, "csi_rs_res_map_s::density_c_::types");
}
uint8_t csi_rs_res_map_s::density_c_::types_opts::to_number() const
{
  static const uint8_t numbers[] = {5, 1, 3};
  return map_enum_number(numbers, 3, value, "csi_rs_res_map_s::density_c_::types");
}

// CSI-ResourcePeriodicityAndOffset ::= CHOICE
void csi_res_periodicity_and_offset_c::destroy_() {}
void csi_res_periodicity_and_offset_c::set(types::options e)
{
  destroy_();
  type_ = e;
}
csi_res_periodicity_and_offset_c::csi_res_periodicity_and_offset_c(const csi_res_periodicity_and_offset_c& other)
{
  type_ = other.type();
  switch (type_) {
    case types::slots4:
      c.init(other.c.get<uint8_t>());
      break;
    case types::slots5:
      c.init(other.c.get<uint8_t>());
      break;
    case types::slots8:
      c.init(other.c.get<uint8_t>());
      break;
    case types::slots10:
      c.init(other.c.get<uint8_t>());
      break;
    case types::slots16:
      c.init(other.c.get<uint8_t>());
      break;
    case types::slots20:
      c.init(other.c.get<uint8_t>());
      break;
    case types::slots32:
      c.init(other.c.get<uint8_t>());
      break;
    case types::slots40:
      c.init(other.c.get<uint8_t>());
      break;
    case types::slots64:
      c.init(other.c.get<uint8_t>());
      break;
    case types::slots80:
      c.init(other.c.get<uint8_t>());
      break;
    case types::slots160:
      c.init(other.c.get<uint8_t>());
      break;
    case types::slots320:
      c.init(other.c.get<uint16_t>());
      break;
    case types::slots640:
      c.init(other.c.get<uint16_t>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "csi_res_periodicity_and_offset_c");
  }
}
csi_res_periodicity_and_offset_c&
csi_res_periodicity_and_offset_c::operator=(const csi_res_periodicity_and_offset_c& other)
{
  if (this == &other) {
    return *this;
  }
  set(other.type());
  switch (type_) {
    case types::slots4:
      c.set(other.c.get<uint8_t>());
      break;
    case types::slots5:
      c.set(other.c.get<uint8_t>());
      break;
    case types::slots8:
      c.set(other.c.get<uint8_t>());
      break;
    case types::slots10:
      c.set(other.c.get<uint8_t>());
      break;
    case types::slots16:
      c.set(other.c.get<uint8_t>());
      break;
    case types::slots20:
      c.set(other.c.get<uint8_t>());
      break;
    case types::slots32:
      c.set(other.c.get<uint8_t>());
      break;
    case types::slots40:
      c.set(other.c.get<uint8_t>());
      break;
    case types::slots64:
      c.set(other.c.get<uint8_t>());
      break;
    case types::slots80:
      c.set(other.c.get<uint8_t>());
      break;
    case types::slots160:
      c.set(other.c.get<uint8_t>());
      break;
    case types::slots320:
      c.set(other.c.get<uint16_t>());
      break;
    case types::slots640:
      c.set(other.c.get<uint16_t>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "csi_res_periodicity_and_offset_c");
  }

  return *this;
}
uint8_t& csi_res_periodicity_and_offset_c::set_slots4()
{
  set(types::slots4);
  return c.get<uint8_t>();
}
uint8_t& csi_res_periodicity_and_offset_c::set_slots5()
{
  set(types::slots5);
  return c.get<uint8_t>();
}
uint8_t& csi_res_periodicity_and_offset_c::set_slots8()
{
  set(types::slots8);
  return c.get<uint8_t>();
}
uint8_t& csi_res_periodicity_and_offset_c::set_slots10()
{
  set(types::slots10);
  return c.get<uint8_t>();
}
uint8_t& csi_res_periodicity_and_offset_c::set_slots16()
{
  set(types::slots16);
  return c.get<uint8_t>();
}
uint8_t& csi_res_periodicity_and_offset_c::set_slots20()
{
  set(types::slots20);
  return c.get<uint8_t>();
}
uint8_t& csi_res_periodicity_and_offset_c::set_slots32()
{
  set(types::slots32);
  return c.get<uint8_t>();
}
uint8_t& csi_res_periodicity_and_offset_c::set_slots40()
{
  set(types::slots40);
  return c.get<uint8_t>();
}
uint8_t& csi_res_periodicity_and_offset_c::set_slots64()
{
  set(types::slots64);
  return c.get<uint8_t>();
}
uint8_t& csi_res_periodicity_and_offset_c::set_slots80()
{
  set(types::slots80);
  return c.get<uint8_t>();
}
uint8_t& csi_res_periodicity_and_offset_c::set_slots160()
{
  set(types::slots160);
  return c.get<uint8_t>();
}
uint16_t& csi_res_periodicity_and_offset_c::set_slots320()
{
  set(types::slots320);
  return c.get<uint16_t>();
}
uint16_t& csi_res_periodicity_and_offset_c::set_slots640()
{
  set(types::slots640);
  return c.get<uint16_t>();
}
void csi_res_periodicity_and_offset_c::to_json(json_writer& j) const
{
  j.start_obj();
  switch (type_) {
    case types::slots4:
      j.write_int("slots4", c.get<uint8_t>());
      break;
    case types::slots5:
      j.write_int("slots5", c.get<uint8_t>());
      break;
    case types::slots8:
      j.write_int("slots8", c.get<uint8_t>());
      break;
    case types::slots10:
      j.write_int("slots10", c.get<uint8_t>());
      break;
    case types::slots16:
      j.write_int("slots16", c.get<uint8_t>());
      break;
    case types::slots20:
      j.write_int("slots20", c.get<uint8_t>());
      break;
    case types::slots32:
      j.write_int("slots32", c.get<uint8_t>());
      break;
    case types::slots40:
      j.write_int("slots40", c.get<uint8_t>());
      break;
    case types::slots64:
      j.write_int("slots64", c.get<uint8_t>());
      break;
    case types::slots80:
      j.write_int("slots80", c.get<uint8_t>());
      break;
    case types::slots160:
      j.write_int("slots160", c.get<uint8_t>());
      break;
    case types::slots320:
      j.write_int("slots320", c.get<uint16_t>());
      break;
    case types::slots640:
      j.write_int("slots640", c.get<uint16_t>());
      break;
    default:
      log_invalid_choice_id(type_, "csi_res_periodicity_and_offset_c");
  }
  j.end_obj();
}
SRSASN_CODE csi_res_periodicity_and_offset_c::pack(bit_ref& bref) const
{
  type_.pack(bref);
  switch (type_) {
    case types::slots4:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)3u));
      break;
    case types::slots5:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)4u));
      break;
    case types::slots8:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)7u));
      break;
    case types::slots10:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)9u));
      break;
    case types::slots16:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)15u));
      break;
    case types::slots20:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)19u));
      break;
    case types::slots32:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)31u));
      break;
    case types::slots40:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)39u));
      break;
    case types::slots64:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)63u));
      break;
    case types::slots80:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)79u));
      break;
    case types::slots160:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)159u));
      break;
    case types::slots320:
      HANDLE_CODE(pack_integer(bref, c.get<uint16_t>(), (uint16_t)0u, (uint16_t)319u));
      break;
    case types::slots640:
      HANDLE_CODE(pack_integer(bref, c.get<uint16_t>(), (uint16_t)0u, (uint16_t)639u));
      break;
    default:
      log_invalid_choice_id(type_, "csi_res_periodicity_and_offset_c");
      return SRSASN_ERROR_ENCODE_FAIL;
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE csi_res_periodicity_and_offset_c::unpack(cbit_ref& bref)
{
  types e;
  e.unpack(bref);
  set(e);
  switch (type_) {
    case types::slots4:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)3u));
      break;
    case types::slots5:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)4u));
      break;
    case types::slots8:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)7u));
      break;
    case types::slots10:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)9u));
      break;
    case types::slots16:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)15u));
      break;
    case types::slots20:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)19u));
      break;
    case types::slots32:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)31u));
      break;
    case types::slots40:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)39u));
      break;
    case types::slots64:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)63u));
      break;
    case types::slots80:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)79u));
      break;
    case types::slots160:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)159u));
      break;
    case types::slots320:
      HANDLE_CODE(unpack_integer(c.get<uint16_t>(), bref, (uint16_t)0u, (uint16_t)319u));
      break;
    case types::slots640:
      HANDLE_CODE(unpack_integer(c.get<uint16_t>(), bref, (uint16_t)0u, (uint16_t)639u));
      break;
    default:
      log_invalid_choice_id(type_, "csi_res_periodicity_and_offset_c");
      return SRSASN_ERROR_DECODE_FAIL;
  }
  return SRSASN_SUCCESS;
}

const char* csi_res_periodicity_and_offset_c::types_opts::to_string() const
{
  static const char* names[] = {"slots4",
                                "slots5",
                                "slots8",
                                "slots10",
                                "slots16",
                                "slots20",
                                "slots32",
                                "slots40",
                                "slots64",
                                "slots80",
                                "slots160",
                                "slots320",
                                "slots640"};
  return convert_enum_idx(names, 13, value, "csi_res_periodicity_and_offset_c::types");
}
uint16_t csi_res_periodicity_and_offset_c::types_opts::to_number() const
{
  static const uint16_t numbers[] = {4, 5, 8, 10, 16, 20, 32, 40, 64, 80, 160, 320, 640};
  return map_enum_number(numbers, 13, value, "csi_res_periodicity_and_offset_c::types");
}

// FDM-TDM-r16 ::= SEQUENCE
SRSASN_CODE fdm_tdm_r16_s::pack(bit_ref& bref) const
{
  HANDLE_CODE(bref.pack(start_symbol_offset_k_r16_present, 1));

  HANDLE_CODE(repeat_scheme_r16.pack(bref));
  if (start_symbol_offset_k_r16_present) {
    HANDLE_CODE(pack_integer(bref, start_symbol_offset_k_r16, (uint8_t)0u, (uint8_t)7u));
  }

  return SRSASN_SUCCESS;
}
SRSASN_CODE fdm_tdm_r16_s::unpack(cbit_ref& bref)
{
  HANDLE_CODE(bref.unpack(start_symbol_offset_k_r16_present, 1));

  HANDLE_CODE(repeat_scheme_r16.unpack(bref));
  if (start_symbol_offset_k_r16_present) {
    HANDLE_CODE(unpack_integer(start_symbol_offset_k_r16, bref, (uint8_t)0u, (uint8_t)7u));
  }

  return SRSASN_SUCCESS;
}
void fdm_tdm_r16_s::to_json(json_writer& j) const
{
  j.start_obj();
  j.write_str("repetitionScheme-r16", repeat_scheme_r16.to_string());
  if (start_symbol_offset_k_r16_present) {
    j.write_int("startingSymbolOffsetK-r16", start_symbol_offset_k_r16);
  }
  j.end_obj();
}

const char* fdm_tdm_r16_s::repeat_scheme_r16_opts::to_string() const
{
  static const char* names[] = {"fdmSchemeA", "fdmSchemeB", "tdmSchemeA"};
  return convert_enum_idx(names, 3, value, "fdm_tdm_r16_s::repeat_scheme_r16_e_");
}

// INT-ConfigurationPerServingCell ::= SEQUENCE
SRSASN_CODE int_cfg_per_serving_cell_s::pack(bit_ref& bref) const
{
  HANDLE_CODE(pack_integer(bref, serving_cell_id, (uint8_t)0u, (uint8_t)31u));
  HANDLE_CODE(pack_integer(bref, position_in_dci, (uint8_t)0u, (uint8_t)125u));

  return SRSASN_SUCCESS;
}
SRSASN_CODE int_cfg_per_serving_cell_s::unpack(cbit_ref& bref)
{
  HANDLE_CODE(unpack_integer(serving_cell_id, bref, (uint8_t)0u, (uint8_t)31u));
  HANDLE_CODE(unpack_integer(position_in_dci, bref, (uint8_t)0u, (uint8_t)125u));

  return SRSASN_SUCCESS;
}
void int_cfg_per_serving_cell_s::to_json(json_writer& j) const
{
  j.start_obj();
  j.write_int("servingCellId", serving_cell_id);
  j.write_int("positionInDCI", position_in_dci);
  j.end_obj();
}

// MultiPDSCH-TDRA-r17 ::= SEQUENCE
SRSASN_CODE multi_pdsch_tdra_r17_s::pack(bit_ref& bref) const
{
  bref.pack(ext, 1);
  HANDLE_CODE(pack_dyn_seq_of(bref, pdsch_tdra_list_r17, 1, 8));

  return SRSASN_SUCCESS;
}
SRSASN_CODE multi_pdsch_tdra_r17_s::unpack(cbit_ref& bref)
{
  bref.unpack(ext, 1);
  HANDLE_CODE(unpack_dyn_seq_of(pdsch_tdra_list_r17, bref, 1, 8));

  return SRSASN_SUCCESS;
}
void multi_pdsch_tdra_r17_s::to_json(json_writer& j) const
{
  j.start_obj();
  j.start_array("pdsch-TDRA-List-r17");
  for (const auto& e1 : pdsch_tdra_list_r17) {
    e1.to_json(j);
  }
  j.end_array();
  j.end_obj();
}

// PTRS-DownlinkConfig ::= SEQUENCE
SRSASN_CODE ptrs_dl_cfg_s::pack(bit_ref& bref) const
{
  bref.pack(ext, 1);
  HANDLE_CODE(bref.pack(freq_density_present, 1));
  HANDLE_CODE(bref.pack(time_density_present, 1));
  HANDLE_CODE(bref.pack(epre_ratio_present, 1));
  HANDLE_CODE(bref.pack(res_elem_offset_present, 1));

  if (freq_density_present) {
    HANDLE_CODE(pack_fixed_seq_of(bref, freq_density, freq_density.size(), integer_packer<uint16_t>(1, 276)));
  }
  if (time_density_present) {
    HANDLE_CODE(pack_fixed_seq_of(bref, time_density, time_density.size(), integer_packer<uint8_t>(0, 29)));
  }
  if (epre_ratio_present) {
    HANDLE_CODE(pack_integer(bref, epre_ratio, (uint8_t)0u, (uint8_t)3u));
  }
  if (res_elem_offset_present) {
    HANDLE_CODE(res_elem_offset.pack(bref));
  }

  if (ext) {
    ext_groups_packer_guard group_flags;
    group_flags[0] |= max_nrof_ports_r16_present;
    group_flags.pack(bref);

    if (group_flags[0]) {
      varlength_field_pack_guard varlen_scope(bref, false);

      HANDLE_CODE(bref.pack(max_nrof_ports_r16_present, 1));
      if (max_nrof_ports_r16_present) {
        HANDLE_CODE(max_nrof_ports_r16.pack(bref));
      }
    }
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE ptrs_dl_cfg_s::unpack(cbit_ref& bref)
{
  bref.unpack(ext, 1);
  HANDLE_CODE(bref.unpack(freq_density_present, 1));
  HANDLE_CODE(bref.unpack(time_density_present, 1));
  HANDLE_CODE(bref.unpack(epre_ratio_present, 1));
  HANDLE_CODE(bref.unpack(res_elem_offset_present, 1));

  if (freq_density_present) {
    HANDLE_CODE(unpack_fixed_seq_of(freq_density, bref, freq_density.size(), integer_packer<uint16_t>(1, 276)));
  }
  if (time_density_present) {
    HANDLE_CODE(unpack_fixed_seq_of(time_density, bref, time_density.size(), integer_packer<uint8_t>(0, 29)));
  }
  if (epre_ratio_present) {
    HANDLE_CODE(unpack_integer(epre_ratio, bref, (uint8_t)0u, (uint8_t)3u));
  }
  if (res_elem_offset_present) {
    HANDLE_CODE(res_elem_offset.unpack(bref));
  }

  if (ext) {
    ext_groups_unpacker_guard group_flags(1);
    group_flags.unpack(bref);

    if (group_flags[0]) {
      varlength_field_unpack_guard varlen_scope(bref, false);

      HANDLE_CODE(bref.unpack(max_nrof_ports_r16_present, 1));
      if (max_nrof_ports_r16_present) {
        HANDLE_CODE(max_nrof_ports_r16.unpack(bref));
      }
    }
  }
  return SRSASN_SUCCESS;
}
void ptrs_dl_cfg_s::to_json(json_writer& j) const
{
  j.start_obj();
  if (freq_density_present) {
    j.start_array("frequencyDensity");
    for (const auto& e1 : freq_density) {
      j.write_int(e1);
    }
    j.end_array();
  }
  if (time_density_present) {
    j.start_array("timeDensity");
    for (const auto& e1 : time_density) {
      j.write_int(e1);
    }
    j.end_array();
  }
  if (epre_ratio_present) {
    j.write_int("epre-Ratio", epre_ratio);
  }
  if (res_elem_offset_present) {
    j.write_str("resourceElementOffset", res_elem_offset.to_string());
  }
  if (ext) {
    if (max_nrof_ports_r16_present) {
      j.write_str("maxNrofPorts-r16", max_nrof_ports_r16.to_string());
    }
  }
  j.end_obj();
}

const char* ptrs_dl_cfg_s::res_elem_offset_opts::to_string() const
{
  static const char* names[] = {"offset01", "offset10", "offset11"};
  return convert_enum_idx(names, 3, value, "ptrs_dl_cfg_s::res_elem_offset_e_");
}
float ptrs_dl_cfg_s::res_elem_offset_opts::to_number() const
{
  static const float numbers[] = {0.1, 1.0, 1.1};
  return map_enum_number(numbers, 3, value, "ptrs_dl_cfg_s::res_elem_offset_e_");
}
const char* ptrs_dl_cfg_s::res_elem_offset_opts::to_number_string() const
{
  static const char* number_strs[] = {"0.1", "1.0", "1.1"};
  return convert_enum_idx(number_strs, 3, value, "ptrs_dl_cfg_s::res_elem_offset_e_");
}

const char* ptrs_dl_cfg_s::max_nrof_ports_r16_opts::to_string() const
{
  static const char* names[] = {"n1", "n2"};
  return convert_enum_idx(names, 2, value, "ptrs_dl_cfg_s::max_nrof_ports_r16_e_");
}
uint8_t ptrs_dl_cfg_s::max_nrof_ports_r16_opts::to_number() const
{
  static const uint8_t numbers[] = {1, 2};
  return map_enum_number(numbers, 2, value, "ptrs_dl_cfg_s::max_nrof_ports_r16_e_");
}

// QCL-Info ::= SEQUENCE
SRSASN_CODE qcl_info_s::pack(bit_ref& bref) const
{
  bref.pack(ext, 1);
  HANDLE_CODE(bref.pack(cell_present, 1));
  HANDLE_CODE(bref.pack(bwp_id_present, 1));

  if (cell_present) {
    HANDLE_CODE(pack_integer(bref, cell, (uint8_t)0u, (uint8_t)31u));
  }
  if (bwp_id_present) {
    HANDLE_CODE(pack_integer(bref, bwp_id, (uint8_t)0u, (uint8_t)4u));
  }
  HANDLE_CODE(ref_sig.pack(bref));
  HANDLE_CODE(qcl_type.pack(bref));

  return SRSASN_SUCCESS;
}
SRSASN_CODE qcl_info_s::unpack(cbit_ref& bref)
{
  bref.unpack(ext, 1);
  HANDLE_CODE(bref.unpack(cell_present, 1));
  HANDLE_CODE(bref.unpack(bwp_id_present, 1));

  if (cell_present) {
    HANDLE_CODE(unpack_integer(cell, bref, (uint8_t)0u, (uint8_t)31u));
  }
  if (bwp_id_present) {
    HANDLE_CODE(unpack_integer(bwp_id, bref, (uint8_t)0u, (uint8_t)4u));
  }
  HANDLE_CODE(ref_sig.unpack(bref));
  HANDLE_CODE(qcl_type.unpack(bref));

  return SRSASN_SUCCESS;
}
void qcl_info_s::to_json(json_writer& j) const
{
  j.start_obj();
  if (cell_present) {
    j.write_int("cell", cell);
  }
  if (bwp_id_present) {
    j.write_int("bwp-Id", bwp_id);
  }
  j.write_fieldname("referenceSignal");
  ref_sig.to_json(j);
  j.write_str("qcl-Type", qcl_type.to_string());
  j.end_obj();
}

void qcl_info_s::ref_sig_c_::destroy_() {}
void qcl_info_s::ref_sig_c_::set(types::options e)
{
  destroy_();
  type_ = e;
}
qcl_info_s::ref_sig_c_::ref_sig_c_(const qcl_info_s::ref_sig_c_& other)
{
  type_ = other.type();
  switch (type_) {
    case types::csi_rs:
      c.init(other.c.get<uint8_t>());
      break;
    case types::ssb:
      c.init(other.c.get<uint8_t>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "qcl_info_s::ref_sig_c_");
  }
}
qcl_info_s::ref_sig_c_& qcl_info_s::ref_sig_c_::operator=(const qcl_info_s::ref_sig_c_& other)
{
  if (this == &other) {
    return *this;
  }
  set(other.type());
  switch (type_) {
    case types::csi_rs:
      c.set(other.c.get<uint8_t>());
      break;
    case types::ssb:
      c.set(other.c.get<uint8_t>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "qcl_info_s::ref_sig_c_");
  }

  return *this;
}
uint8_t& qcl_info_s::ref_sig_c_::set_csi_rs()
{
  set(types::csi_rs);
  return c.get<uint8_t>();
}
uint8_t& qcl_info_s::ref_sig_c_::set_ssb()
{
  set(types::ssb);
  return c.get<uint8_t>();
}
void qcl_info_s::ref_sig_c_::to_json(json_writer& j) const
{
  j.start_obj();
  switch (type_) {
    case types::csi_rs:
      j.write_int("csi-rs", c.get<uint8_t>());
      break;
    case types::ssb:
      j.write_int("ssb", c.get<uint8_t>());
      break;
    default:
      log_invalid_choice_id(type_, "qcl_info_s::ref_sig_c_");
  }
  j.end_obj();
}
SRSASN_CODE qcl_info_s::ref_sig_c_::pack(bit_ref& bref) const
{
  type_.pack(bref);
  switch (type_) {
    case types::csi_rs:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)191u));
      break;
    case types::ssb:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)63u));
      break;
    default:
      log_invalid_choice_id(type_, "qcl_info_s::ref_sig_c_");
      return SRSASN_ERROR_ENCODE_FAIL;
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE qcl_info_s::ref_sig_c_::unpack(cbit_ref& bref)
{
  types e;
  e.unpack(bref);
  set(e);
  switch (type_) {
    case types::csi_rs:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)191u));
      break;
    case types::ssb:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)63u));
      break;
    default:
      log_invalid_choice_id(type_, "qcl_info_s::ref_sig_c_");
      return SRSASN_ERROR_DECODE_FAIL;
  }
  return SRSASN_SUCCESS;
}

const char* qcl_info_s::ref_sig_c_::types_opts::to_string() const
{
  static const char* names[] = {"csi-rs", "ssb"};
  return convert_enum_idx(names, 2, value, "qcl_info_s::ref_sig_c_::types");
}

const char* qcl_info_s::qcl_type_opts::to_string() const
{
  static const char* names[] = {"typeA", "typeB", "typeC", "typeD"};
  return convert_enum_idx(names, 4, value, "qcl_info_s::qcl_type_e_");
}

// SlotBased-r16 ::= SEQUENCE
SRSASN_CODE slot_based_r16_s::pack(bit_ref& bref) const
{
  HANDLE_CODE(tci_map_r16.pack(bref));
  HANDLE_CODE(pack_integer(bref, seq_offset_for_rv_r16, (uint8_t)1u, (uint8_t)3u));

  return SRSASN_SUCCESS;
}
SRSASN_CODE slot_based_r16_s::unpack(cbit_ref& bref)
{
  HANDLE_CODE(tci_map_r16.unpack(bref));
  HANDLE_CODE(unpack_integer(seq_offset_for_rv_r16, bref, (uint8_t)1u, (uint8_t)3u));

  return SRSASN_SUCCESS;
}
void slot_based_r16_s::to_json(json_writer& j) const
{
  j.start_obj();
  j.write_str("tciMapping-r16", tci_map_r16.to_string());
  j.write_int("sequenceOffsetForRV-r16", seq_offset_for_rv_r16);
  j.end_obj();
}

const char* slot_based_r16_s::tci_map_r16_opts::to_string() const
{
  static const char* names[] = {"cyclicMapping", "sequentialMapping"};
  return convert_enum_idx(names, 2, value, "slot_based_r16_s::tci_map_r16_e_");
}

// SlotBased-v1630 ::= SEQUENCE
SRSASN_CODE slot_based_v1630_s::pack(bit_ref& bref) const
{
  HANDLE_CODE(tci_map_r16.pack(bref));
  HANDLE_CODE(pack_integer(bref, seq_offset_for_rv_r16, (uint8_t)0u, (uint8_t)0u));

  return SRSASN_SUCCESS;
}
SRSASN_CODE slot_based_v1630_s::unpack(cbit_ref& bref)
{
  HANDLE_CODE(tci_map_r16.unpack(bref));
  HANDLE_CODE(unpack_integer(seq_offset_for_rv_r16, bref, (uint8_t)0u, (uint8_t)0u));

  return SRSASN_SUCCESS;
}
void slot_based_v1630_s::to_json(json_writer& j) const
{
  j.start_obj();
  j.write_str("tciMapping-r16", tci_map_r16.to_string());
  j.write_int("sequenceOffsetForRV-r16", seq_offset_for_rv_r16);
  j.end_obj();
}

const char* slot_based_v1630_s::tci_map_r16_opts::to_string() const
{
  static const char* names[] = {"cyclicMapping", "sequentialMapping"};
  return convert_enum_idx(names, 2, value, "slot_based_v1630_s::tci_map_r16_e_");
}

// BeamFailureDetectionSet-r17 ::= SEQUENCE
SRSASN_CODE beam_fail_detection_set_r17_s::pack(bit_ref& bref) const
{
  bref.pack(ext, 1);
  HANDLE_CODE(bref.pack(bfd_res_to_add_mod_list_r17.size() > 0, 1));
  HANDLE_CODE(bref.pack(bfd_res_to_release_list_r17.size() > 0, 1));
  HANDLE_CODE(bref.pack(beam_fail_instance_max_count_r17_present, 1));
  HANDLE_CODE(bref.pack(beam_fail_detection_timer_r17_present, 1));

  if (bfd_res_to_add_mod_list_r17.size() > 0) {
    HANDLE_CODE(pack_dyn_seq_of(bref, bfd_res_to_add_mod_list_r17, 1, 64));
  }
  if (bfd_res_to_release_list_r17.size() > 0) {
    HANDLE_CODE(pack_dyn_seq_of(bref, bfd_res_to_release_list_r17, 1, 64, integer_packer<uint8_t>(0, 63)));
  }
  if (beam_fail_instance_max_count_r17_present) {
    HANDLE_CODE(beam_fail_instance_max_count_r17.pack(bref));
  }
  if (beam_fail_detection_timer_r17_present) {
    HANDLE_CODE(beam_fail_detection_timer_r17.pack(bref));
  }

  return SRSASN_SUCCESS;
}
SRSASN_CODE beam_fail_detection_set_r17_s::unpack(cbit_ref& bref)
{
  bref.unpack(ext, 1);
  bool bfd_res_to_add_mod_list_r17_present;
  HANDLE_CODE(bref.unpack(bfd_res_to_add_mod_list_r17_present, 1));
  bool bfd_res_to_release_list_r17_present;
  HANDLE_CODE(bref.unpack(bfd_res_to_release_list_r17_present, 1));
  HANDLE_CODE(bref.unpack(beam_fail_instance_max_count_r17_present, 1));
  HANDLE_CODE(bref.unpack(beam_fail_detection_timer_r17_present, 1));

  if (bfd_res_to_add_mod_list_r17_present) {
    HANDLE_CODE(unpack_dyn_seq_of(bfd_res_to_add_mod_list_r17, bref, 1, 64));
  }
  if (bfd_res_to_release_list_r17_present) {
    HANDLE_CODE(unpack_dyn_seq_of(bfd_res_to_release_list_r17, bref, 1, 64, integer_packer<uint8_t>(0, 63)));
  }
  if (beam_fail_instance_max_count_r17_present) {
    HANDLE_CODE(beam_fail_instance_max_count_r17.unpack(bref));
  }
  if (beam_fail_detection_timer_r17_present) {
    HANDLE_CODE(beam_fail_detection_timer_r17.unpack(bref));
  }

  return SRSASN_SUCCESS;
}
void beam_fail_detection_set_r17_s::to_json(json_writer& j) const
{
  j.start_obj();
  if (bfd_res_to_add_mod_list_r17.size() > 0) {
    j.start_array("bfdResourcesToAddModList-r17");
    for (const auto& e1 : bfd_res_to_add_mod_list_r17) {
      e1.to_json(j);
    }
    j.end_array();
  }
  if (bfd_res_to_release_list_r17.size() > 0) {
    j.start_array("bfdResourcesToReleaseList-r17");
    for (const auto& e1 : bfd_res_to_release_list_r17) {
      j.write_int(e1);
    }
    j.end_array();
  }
  if (beam_fail_instance_max_count_r17_present) {
    j.write_str("beamFailureInstanceMaxCount-r17", beam_fail_instance_max_count_r17.to_string());
  }
  if (beam_fail_detection_timer_r17_present) {
    j.write_str("beamFailureDetectionTimer-r17", beam_fail_detection_timer_r17.to_string());
  }
  j.end_obj();
}

const char* beam_fail_detection_set_r17_s::beam_fail_instance_max_count_r17_opts::to_string() const
{
  static const char* names[] = {"n1", "n2", "n3", "n4", "n5", "n6", "n8", "n10"};
  return convert_enum_idx(names, 8, value, "beam_fail_detection_set_r17_s::beam_fail_instance_max_count_r17_e_");
}
uint8_t beam_fail_detection_set_r17_s::beam_fail_instance_max_count_r17_opts::to_number() const
{
  static const uint8_t numbers[] = {1, 2, 3, 4, 5, 6, 8, 10};
  return map_enum_number(numbers, 8, value, "beam_fail_detection_set_r17_s::beam_fail_instance_max_count_r17_e_");
}

const char* beam_fail_detection_set_r17_s::beam_fail_detection_timer_r17_opts::to_string() const
{
  static const char* names[] = {"pbfd1", "pbfd2", "pbfd3", "pbfd4", "pbfd5", "pbfd6", "pbfd8", "pbfd10"};
  return convert_enum_idx(names, 8, value, "beam_fail_detection_set_r17_s::beam_fail_detection_timer_r17_e_");
}
uint8_t beam_fail_detection_set_r17_s::beam_fail_detection_timer_r17_opts::to_number() const
{
  static const uint8_t numbers[] = {1, 2, 3, 4, 5, 6, 8, 10};
  return map_enum_number(numbers, 8, value, "beam_fail_detection_set_r17_s::beam_fail_detection_timer_r17_e_");
}

// DL-PPW-PeriodicityAndStartSlot-r17 ::= CHOICE
void dl_ppw_periodicity_and_start_slot_r17_c::destroy_()
{
  switch (type_) {
    case types::scs15:
      c.destroy<scs15_c_>();
      break;
    case types::scs30:
      c.destroy<scs30_c_>();
      break;
    case types::scs60:
      c.destroy<scs60_c_>();
      break;
    case types::scs120:
      c.destroy<scs120_c_>();
      break;
    default:
      break;
  }
}
void dl_ppw_periodicity_and_start_slot_r17_c::set(types::options e)
{
  destroy_();
  type_ = e;
  switch (type_) {
    case types::scs15:
      c.init<scs15_c_>();
      break;
    case types::scs30:
      c.init<scs30_c_>();
      break;
    case types::scs60:
      c.init<scs60_c_>();
      break;
    case types::scs120:
      c.init<scs120_c_>();
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "dl_ppw_periodicity_and_start_slot_r17_c");
  }
}
dl_ppw_periodicity_and_start_slot_r17_c::dl_ppw_periodicity_and_start_slot_r17_c(
    const dl_ppw_periodicity_and_start_slot_r17_c& other)
{
  type_ = other.type();
  switch (type_) {
    case types::scs15:
      c.init(other.c.get<scs15_c_>());
      break;
    case types::scs30:
      c.init(other.c.get<scs30_c_>());
      break;
    case types::scs60:
      c.init(other.c.get<scs60_c_>());
      break;
    case types::scs120:
      c.init(other.c.get<scs120_c_>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "dl_ppw_periodicity_and_start_slot_r17_c");
  }
}
dl_ppw_periodicity_and_start_slot_r17_c&
dl_ppw_periodicity_and_start_slot_r17_c::operator=(const dl_ppw_periodicity_and_start_slot_r17_c& other)
{
  if (this == &other) {
    return *this;
  }
  set(other.type());
  switch (type_) {
    case types::scs15:
      c.set(other.c.get<scs15_c_>());
      break;
    case types::scs30:
      c.set(other.c.get<scs30_c_>());
      break;
    case types::scs60:
      c.set(other.c.get<scs60_c_>());
      break;
    case types::scs120:
      c.set(other.c.get<scs120_c_>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "dl_ppw_periodicity_and_start_slot_r17_c");
  }

  return *this;
}
dl_ppw_periodicity_and_start_slot_r17_c::scs15_c_& dl_ppw_periodicity_and_start_slot_r17_c::set_scs15()
{
  set(types::scs15);
  return c.get<scs15_c_>();
}
dl_ppw_periodicity_and_start_slot_r17_c::scs30_c_& dl_ppw_periodicity_and_start_slot_r17_c::set_scs30()
{
  set(types::scs30);
  return c.get<scs30_c_>();
}
dl_ppw_periodicity_and_start_slot_r17_c::scs60_c_& dl_ppw_periodicity_and_start_slot_r17_c::set_scs60()
{
  set(types::scs60);
  return c.get<scs60_c_>();
}
dl_ppw_periodicity_and_start_slot_r17_c::scs120_c_& dl_ppw_periodicity_and_start_slot_r17_c::set_scs120()
{
  set(types::scs120);
  return c.get<scs120_c_>();
}
void dl_ppw_periodicity_and_start_slot_r17_c::to_json(json_writer& j) const
{
  j.start_obj();
  switch (type_) {
    case types::scs15:
      j.write_fieldname("scs15");
      c.get<scs15_c_>().to_json(j);
      break;
    case types::scs30:
      j.write_fieldname("scs30");
      c.get<scs30_c_>().to_json(j);
      break;
    case types::scs60:
      j.write_fieldname("scs60");
      c.get<scs60_c_>().to_json(j);
      break;
    case types::scs120:
      j.write_fieldname("scs120");
      c.get<scs120_c_>().to_json(j);
      break;
    default:
      log_invalid_choice_id(type_, "dl_ppw_periodicity_and_start_slot_r17_c");
  }
  j.end_obj();
}
SRSASN_CODE dl_ppw_periodicity_and_start_slot_r17_c::pack(bit_ref& bref) const
{
  type_.pack(bref);
  switch (type_) {
    case types::scs15:
      HANDLE_CODE(c.get<scs15_c_>().pack(bref));
      break;
    case types::scs30:
      HANDLE_CODE(c.get<scs30_c_>().pack(bref));
      break;
    case types::scs60:
      HANDLE_CODE(c.get<scs60_c_>().pack(bref));
      break;
    case types::scs120:
      HANDLE_CODE(c.get<scs120_c_>().pack(bref));
      break;
    default:
      log_invalid_choice_id(type_, "dl_ppw_periodicity_and_start_slot_r17_c");
      return SRSASN_ERROR_ENCODE_FAIL;
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE dl_ppw_periodicity_and_start_slot_r17_c::unpack(cbit_ref& bref)
{
  types e;
  e.unpack(bref);
  set(e);
  switch (type_) {
    case types::scs15:
      HANDLE_CODE(c.get<scs15_c_>().unpack(bref));
      break;
    case types::scs30:
      HANDLE_CODE(c.get<scs30_c_>().unpack(bref));
      break;
    case types::scs60:
      HANDLE_CODE(c.get<scs60_c_>().unpack(bref));
      break;
    case types::scs120:
      HANDLE_CODE(c.get<scs120_c_>().unpack(bref));
      break;
    default:
      log_invalid_choice_id(type_, "dl_ppw_periodicity_and_start_slot_r17_c");
      return SRSASN_ERROR_DECODE_FAIL;
  }
  return SRSASN_SUCCESS;
}

void dl_ppw_periodicity_and_start_slot_r17_c::scs15_c_::destroy_() {}
void dl_ppw_periodicity_and_start_slot_r17_c::scs15_c_::set(types::options e)
{
  destroy_();
  type_ = e;
}
dl_ppw_periodicity_and_start_slot_r17_c::scs15_c_::scs15_c_(
    const dl_ppw_periodicity_and_start_slot_r17_c::scs15_c_& other)
{
  type_ = other.type();
  switch (type_) {
    case types::n4:
      c.init(other.c.get<uint8_t>());
      break;
    case types::n5:
      c.init(other.c.get<uint8_t>());
      break;
    case types::n8:
      c.init(other.c.get<uint8_t>());
      break;
    case types::n10:
      c.init(other.c.get<uint8_t>());
      break;
    case types::n16:
      c.init(other.c.get<uint8_t>());
      break;
    case types::n20:
      c.init(other.c.get<uint8_t>());
      break;
    case types::n32:
      c.init(other.c.get<uint8_t>());
      break;
    case types::n40:
      c.init(other.c.get<uint8_t>());
      break;
    case types::n64:
      c.init(other.c.get<uint8_t>());
      break;
    case types::n80:
      c.init(other.c.get<uint8_t>());
      break;
    case types::n160:
      c.init(other.c.get<uint8_t>());
      break;
    case types::n320:
      c.init(other.c.get<uint16_t>());
      break;
    case types::n640:
      c.init(other.c.get<uint16_t>());
      break;
    case types::n1280:
      c.init(other.c.get<uint16_t>());
      break;
    case types::n2560:
      c.init(other.c.get<uint16_t>());
      break;
    case types::n5120:
      c.init(other.c.get<uint16_t>());
      break;
    case types::n10240:
      c.init(other.c.get<uint16_t>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "dl_ppw_periodicity_and_start_slot_r17_c::scs15_c_");
  }
}
dl_ppw_periodicity_and_start_slot_r17_c::scs15_c_& dl_ppw_periodicity_and_start_slot_r17_c::scs15_c_::operator=(
    const dl_ppw_periodicity_and_start_slot_r17_c::scs15_c_& other)
{
  if (this == &other) {
    return *this;
  }
  set(other.type());
  switch (type_) {
    case types::n4:
      c.set(other.c.get<uint8_t>());
      break;
    case types::n5:
      c.set(other.c.get<uint8_t>());
      break;
    case types::n8:
      c.set(other.c.get<uint8_t>());
      break;
    case types::n10:
      c.set(other.c.get<uint8_t>());
      break;
    case types::n16:
      c.set(other.c.get<uint8_t>());
      break;
    case types::n20:
      c.set(other.c.get<uint8_t>());
      break;
    case types::n32:
      c.set(other.c.get<uint8_t>());
      break;
    case types::n40:
      c.set(other.c.get<uint8_t>());
      break;
    case types::n64:
      c.set(other.c.get<uint8_t>());
      break;
    case types::n80:
      c.set(other.c.get<uint8_t>());
      break;
    case types::n160:
      c.set(other.c.get<uint8_t>());
      break;
    case types::n320:
      c.set(other.c.get<uint16_t>());
      break;
    case types::n640:
      c.set(other.c.get<uint16_t>());
      break;
    case types::n1280:
      c.set(other.c.get<uint16_t>());
      break;
    case types::n2560:
      c.set(other.c.get<uint16_t>());
      break;
    case types::n5120:
      c.set(other.c.get<uint16_t>());
      break;
    case types::n10240:
      c.set(other.c.get<uint16_t>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "dl_ppw_periodicity_and_start_slot_r17_c::scs15_c_");
  }

  return *this;
}
uint8_t& dl_ppw_periodicity_and_start_slot_r17_c::scs15_c_::set_n4()
{
  set(types::n4);
  return c.get<uint8_t>();
}
uint8_t& dl_ppw_periodicity_and_start_slot_r17_c::scs15_c_::set_n5()
{
  set(types::n5);
  return c.get<uint8_t>();
}
uint8_t& dl_ppw_periodicity_and_start_slot_r17_c::scs15_c_::set_n8()
{
  set(types::n8);
  return c.get<uint8_t>();
}
uint8_t& dl_ppw_periodicity_and_start_slot_r17_c::scs15_c_::set_n10()
{
  set(types::n10);
  return c.get<uint8_t>();
}
uint8_t& dl_ppw_periodicity_and_start_slot_r17_c::scs15_c_::set_n16()
{
  set(types::n16);
  return c.get<uint8_t>();
}
uint8_t& dl_ppw_periodicity_and_start_slot_r17_c::scs15_c_::set_n20()
{
  set(types::n20);
  return c.get<uint8_t>();
}
uint8_t& dl_ppw_periodicity_and_start_slot_r17_c::scs15_c_::set_n32()
{
  set(types::n32);
  return c.get<uint8_t>();
}
uint8_t& dl_ppw_periodicity_and_start_slot_r17_c::scs15_c_::set_n40()
{
  set(types::n40);
  return c.get<uint8_t>();
}
uint8_t& dl_ppw_periodicity_and_start_slot_r17_c::scs15_c_::set_n64()
{
  set(types::n64);
  return c.get<uint8_t>();
}
uint8_t& dl_ppw_periodicity_and_start_slot_r17_c::scs15_c_::set_n80()
{
  set(types::n80);
  return c.get<uint8_t>();
}
uint8_t& dl_ppw_periodicity_and_start_slot_r17_c::scs15_c_::set_n160()
{
  set(types::n160);
  return c.get<uint8_t>();
}
uint16_t& dl_ppw_periodicity_and_start_slot_r17_c::scs15_c_::set_n320()
{
  set(types::n320);
  return c.get<uint16_t>();
}
uint16_t& dl_ppw_periodicity_and_start_slot_r17_c::scs15_c_::set_n640()
{
  set(types::n640);
  return c.get<uint16_t>();
}
uint16_t& dl_ppw_periodicity_and_start_slot_r17_c::scs15_c_::set_n1280()
{
  set(types::n1280);
  return c.get<uint16_t>();
}
uint16_t& dl_ppw_periodicity_and_start_slot_r17_c::scs15_c_::set_n2560()
{
  set(types::n2560);
  return c.get<uint16_t>();
}
uint16_t& dl_ppw_periodicity_and_start_slot_r17_c::scs15_c_::set_n5120()
{
  set(types::n5120);
  return c.get<uint16_t>();
}
uint16_t& dl_ppw_periodicity_and_start_slot_r17_c::scs15_c_::set_n10240()
{
  set(types::n10240);
  return c.get<uint16_t>();
}
void dl_ppw_periodicity_and_start_slot_r17_c::scs15_c_::to_json(json_writer& j) const
{
  j.start_obj();
  switch (type_) {
    case types::n4:
      j.write_int("n4", c.get<uint8_t>());
      break;
    case types::n5:
      j.write_int("n5", c.get<uint8_t>());
      break;
    case types::n8:
      j.write_int("n8", c.get<uint8_t>());
      break;
    case types::n10:
      j.write_int("n10", c.get<uint8_t>());
      break;
    case types::n16:
      j.write_int("n16", c.get<uint8_t>());
      break;
    case types::n20:
      j.write_int("n20", c.get<uint8_t>());
      break;
    case types::n32:
      j.write_int("n32", c.get<uint8_t>());
      break;
    case types::n40:
      j.write_int("n40", c.get<uint8_t>());
      break;
    case types::n64:
      j.write_int("n64", c.get<uint8_t>());
      break;
    case types::n80:
      j.write_int("n80", c.get<uint8_t>());
      break;
    case types::n160:
      j.write_int("n160", c.get<uint8_t>());
      break;
    case types::n320:
      j.write_int("n320", c.get<uint16_t>());
      break;
    case types::n640:
      j.write_int("n640", c.get<uint16_t>());
      break;
    case types::n1280:
      j.write_int("n1280", c.get<uint16_t>());
      break;
    case types::n2560:
      j.write_int("n2560", c.get<uint16_t>());
      break;
    case types::n5120:
      j.write_int("n5120", c.get<uint16_t>());
      break;
    case types::n10240:
      j.write_int("n10240", c.get<uint16_t>());
      break;
    default:
      log_invalid_choice_id(type_, "dl_ppw_periodicity_and_start_slot_r17_c::scs15_c_");
  }
  j.end_obj();
}
SRSASN_CODE dl_ppw_periodicity_and_start_slot_r17_c::scs15_c_::pack(bit_ref& bref) const
{
  type_.pack(bref);
  switch (type_) {
    case types::n4:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)3u));
      break;
    case types::n5:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)4u));
      break;
    case types::n8:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)7u));
      break;
    case types::n10:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)9u));
      break;
    case types::n16:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)15u));
      break;
    case types::n20:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)19u));
      break;
    case types::n32:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)31u));
      break;
    case types::n40:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)39u));
      break;
    case types::n64:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)63u));
      break;
    case types::n80:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)79u));
      break;
    case types::n160:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)159u));
      break;
    case types::n320:
      HANDLE_CODE(pack_integer(bref, c.get<uint16_t>(), (uint16_t)0u, (uint16_t)319u));
      break;
    case types::n640:
      HANDLE_CODE(pack_integer(bref, c.get<uint16_t>(), (uint16_t)0u, (uint16_t)639u));
      break;
    case types::n1280:
      HANDLE_CODE(pack_integer(bref, c.get<uint16_t>(), (uint16_t)0u, (uint16_t)1279u));
      break;
    case types::n2560:
      HANDLE_CODE(pack_integer(bref, c.get<uint16_t>(), (uint16_t)0u, (uint16_t)2559u));
      break;
    case types::n5120:
      HANDLE_CODE(pack_integer(bref, c.get<uint16_t>(), (uint16_t)0u, (uint16_t)5119u));
      break;
    case types::n10240:
      HANDLE_CODE(pack_integer(bref, c.get<uint16_t>(), (uint16_t)0u, (uint16_t)10239u));
      break;
    default:
      log_invalid_choice_id(type_, "dl_ppw_periodicity_and_start_slot_r17_c::scs15_c_");
      return SRSASN_ERROR_ENCODE_FAIL;
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE dl_ppw_periodicity_and_start_slot_r17_c::scs15_c_::unpack(cbit_ref& bref)
{
  types e;
  e.unpack(bref);
  set(e);
  switch (type_) {
    case types::n4:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)3u));
      break;
    case types::n5:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)4u));
      break;
    case types::n8:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)7u));
      break;
    case types::n10:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)9u));
      break;
    case types::n16:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)15u));
      break;
    case types::n20:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)19u));
      break;
    case types::n32:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)31u));
      break;
    case types::n40:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)39u));
      break;
    case types::n64:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)63u));
      break;
    case types::n80:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)79u));
      break;
    case types::n160:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)159u));
      break;
    case types::n320:
      HANDLE_CODE(unpack_integer(c.get<uint16_t>(), bref, (uint16_t)0u, (uint16_t)319u));
      break;
    case types::n640:
      HANDLE_CODE(unpack_integer(c.get<uint16_t>(), bref, (uint16_t)0u, (uint16_t)639u));
      break;
    case types::n1280:
      HANDLE_CODE(unpack_integer(c.get<uint16_t>(), bref, (uint16_t)0u, (uint16_t)1279u));
      break;
    case types::n2560:
      HANDLE_CODE(unpack_integer(c.get<uint16_t>(), bref, (uint16_t)0u, (uint16_t)2559u));
      break;
    case types::n5120:
      HANDLE_CODE(unpack_integer(c.get<uint16_t>(), bref, (uint16_t)0u, (uint16_t)5119u));
      break;
    case types::n10240:
      HANDLE_CODE(unpack_integer(c.get<uint16_t>(), bref, (uint16_t)0u, (uint16_t)10239u));
      break;
    default:
      log_invalid_choice_id(type_, "dl_ppw_periodicity_and_start_slot_r17_c::scs15_c_");
      return SRSASN_ERROR_DECODE_FAIL;
  }
  return SRSASN_SUCCESS;
}

const char* dl_ppw_periodicity_and_start_slot_r17_c::scs15_c_::types_opts::to_string() const
{
  static const char* names[] = {"n4",
                                "n5",
                                "n8",
                                "n10",
                                "n16",
                                "n20",
                                "n32",
                                "n40",
                                "n64",
                                "n80",
                                "n160",
                                "n320",
                                "n640",
                                "n1280",
                                "n2560",
                                "n5120",
                                "n10240"};
  return convert_enum_idx(names, 17, value, "dl_ppw_periodicity_and_start_slot_r17_c::scs15_c_::types");
}
uint16_t dl_ppw_periodicity_and_start_slot_r17_c::scs15_c_::types_opts::to_number() const
{
  static const uint16_t numbers[] = {4, 5, 8, 10, 16, 20, 32, 40, 64, 80, 160, 320, 640, 1280, 2560, 5120, 10240};
  return map_enum_number(numbers, 17, value, "dl_ppw_periodicity_and_start_slot_r17_c::scs15_c_::types");
}

void dl_ppw_periodicity_and_start_slot_r17_c::scs30_c_::destroy_() {}
void dl_ppw_periodicity_and_start_slot_r17_c::scs30_c_::set(types::options e)
{
  destroy_();
  type_ = e;
}
dl_ppw_periodicity_and_start_slot_r17_c::scs30_c_::scs30_c_(
    const dl_ppw_periodicity_and_start_slot_r17_c::scs30_c_& other)
{
  type_ = other.type();
  switch (type_) {
    case types::n8:
      c.init(other.c.get<uint8_t>());
      break;
    case types::n10:
      c.init(other.c.get<uint8_t>());
      break;
    case types::n16:
      c.init(other.c.get<uint8_t>());
      break;
    case types::n20:
      c.init(other.c.get<uint8_t>());
      break;
    case types::n32:
      c.init(other.c.get<uint8_t>());
      break;
    case types::n40:
      c.init(other.c.get<uint8_t>());
      break;
    case types::n64:
      c.init(other.c.get<uint8_t>());
      break;
    case types::n80:
      c.init(other.c.get<uint8_t>());
      break;
    case types::n128:
      c.init(other.c.get<uint8_t>());
      break;
    case types::n160:
      c.init(other.c.get<uint8_t>());
      break;
    case types::n320:
      c.init(other.c.get<uint16_t>());
      break;
    case types::n640:
      c.init(other.c.get<uint16_t>());
      break;
    case types::n1280:
      c.init(other.c.get<uint16_t>());
      break;
    case types::n2560:
      c.init(other.c.get<uint16_t>());
      break;
    case types::n5120:
      c.init(other.c.get<uint16_t>());
      break;
    case types::n10240:
      c.init(other.c.get<uint16_t>());
      break;
    case types::n20480:
      c.init(other.c.get<uint16_t>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "dl_ppw_periodicity_and_start_slot_r17_c::scs30_c_");
  }
}
dl_ppw_periodicity_and_start_slot_r17_c::scs30_c_& dl_ppw_periodicity_and_start_slot_r17_c::scs30_c_::operator=(
    const dl_ppw_periodicity_and_start_slot_r17_c::scs30_c_& other)
{
  if (this == &other) {
    return *this;
  }
  set(other.type());
  switch (type_) {
    case types::n8:
      c.set(other.c.get<uint8_t>());
      break;
    case types::n10:
      c.set(other.c.get<uint8_t>());
      break;
    case types::n16:
      c.set(other.c.get<uint8_t>());
      break;
    case types::n20:
      c.set(other.c.get<uint8_t>());
      break;
    case types::n32:
      c.set(other.c.get<uint8_t>());
      break;
    case types::n40:
      c.set(other.c.get<uint8_t>());
      break;
    case types::n64:
      c.set(other.c.get<uint8_t>());
      break;
    case types::n80:
      c.set(other.c.get<uint8_t>());
      break;
    case types::n128:
      c.set(other.c.get<uint8_t>());
      break;
    case types::n160:
      c.set(other.c.get<uint8_t>());
      break;
    case types::n320:
      c.set(other.c.get<uint16_t>());
      break;
    case types::n640:
      c.set(other.c.get<uint16_t>());
      break;
    case types::n1280:
      c.set(other.c.get<uint16_t>());
      break;
    case types::n2560:
      c.set(other.c.get<uint16_t>());
      break;
    case types::n5120:
      c.set(other.c.get<uint16_t>());
      break;
    case types::n10240:
      c.set(other.c.get<uint16_t>());
      break;
    case types::n20480:
      c.set(other.c.get<uint16_t>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "dl_ppw_periodicity_and_start_slot_r17_c::scs30_c_");
  }

  return *this;
}
uint8_t& dl_ppw_periodicity_and_start_slot_r17_c::scs30_c_::set_n8()
{
  set(types::n8);
  return c.get<uint8_t>();
}
uint8_t& dl_ppw_periodicity_and_start_slot_r17_c::scs30_c_::set_n10()
{
  set(types::n10);
  return c.get<uint8_t>();
}
uint8_t& dl_ppw_periodicity_and_start_slot_r17_c::scs30_c_::set_n16()
{
  set(types::n16);
  return c.get<uint8_t>();
}
uint8_t& dl_ppw_periodicity_and_start_slot_r17_c::scs30_c_::set_n20()
{
  set(types::n20);
  return c.get<uint8_t>();
}
uint8_t& dl_ppw_periodicity_and_start_slot_r17_c::scs30_c_::set_n32()
{
  set(types::n32);
  return c.get<uint8_t>();
}
uint8_t& dl_ppw_periodicity_and_start_slot_r17_c::scs30_c_::set_n40()
{
  set(types::n40);
  return c.get<uint8_t>();
}
uint8_t& dl_ppw_periodicity_and_start_slot_r17_c::scs30_c_::set_n64()
{
  set(types::n64);
  return c.get<uint8_t>();
}
uint8_t& dl_ppw_periodicity_and_start_slot_r17_c::scs30_c_::set_n80()
{
  set(types::n80);
  return c.get<uint8_t>();
}
uint8_t& dl_ppw_periodicity_and_start_slot_r17_c::scs30_c_::set_n128()
{
  set(types::n128);
  return c.get<uint8_t>();
}
uint8_t& dl_ppw_periodicity_and_start_slot_r17_c::scs30_c_::set_n160()
{
  set(types::n160);
  return c.get<uint8_t>();
}
uint16_t& dl_ppw_periodicity_and_start_slot_r17_c::scs30_c_::set_n320()
{
  set(types::n320);
  return c.get<uint16_t>();
}
uint16_t& dl_ppw_periodicity_and_start_slot_r17_c::scs30_c_::set_n640()
{
  set(types::n640);
  return c.get<uint16_t>();
}
uint16_t& dl_ppw_periodicity_and_start_slot_r17_c::scs30_c_::set_n1280()
{
  set(types::n1280);
  return c.get<uint16_t>();
}
uint16_t& dl_ppw_periodicity_and_start_slot_r17_c::scs30_c_::set_n2560()
{
  set(types::n2560);
  return c.get<uint16_t>();
}
uint16_t& dl_ppw_periodicity_and_start_slot_r17_c::scs30_c_::set_n5120()
{
  set(types::n5120);
  return c.get<uint16_t>();
}
uint16_t& dl_ppw_periodicity_and_start_slot_r17_c::scs30_c_::set_n10240()
{
  set(types::n10240);
  return c.get<uint16_t>();
}
uint16_t& dl_ppw_periodicity_and_start_slot_r17_c::scs30_c_::set_n20480()
{
  set(types::n20480);
  return c.get<uint16_t>();
}
void dl_ppw_periodicity_and_start_slot_r17_c::scs30_c_::to_json(json_writer& j) const
{
  j.start_obj();
  switch (type_) {
    case types::n8:
      j.write_int("n8", c.get<uint8_t>());
      break;
    case types::n10:
      j.write_int("n10", c.get<uint8_t>());
      break;
    case types::n16:
      j.write_int("n16", c.get<uint8_t>());
      break;
    case types::n20:
      j.write_int("n20", c.get<uint8_t>());
      break;
    case types::n32:
      j.write_int("n32", c.get<uint8_t>());
      break;
    case types::n40:
      j.write_int("n40", c.get<uint8_t>());
      break;
    case types::n64:
      j.write_int("n64", c.get<uint8_t>());
      break;
    case types::n80:
      j.write_int("n80", c.get<uint8_t>());
      break;
    case types::n128:
      j.write_int("n128", c.get<uint8_t>());
      break;
    case types::n160:
      j.write_int("n160", c.get<uint8_t>());
      break;
    case types::n320:
      j.write_int("n320", c.get<uint16_t>());
      break;
    case types::n640:
      j.write_int("n640", c.get<uint16_t>());
      break;
    case types::n1280:
      j.write_int("n1280", c.get<uint16_t>());
      break;
    case types::n2560:
      j.write_int("n2560", c.get<uint16_t>());
      break;
    case types::n5120:
      j.write_int("n5120", c.get<uint16_t>());
      break;
    case types::n10240:
      j.write_int("n10240", c.get<uint16_t>());
      break;
    case types::n20480:
      j.write_int("n20480", c.get<uint16_t>());
      break;
    default:
      log_invalid_choice_id(type_, "dl_ppw_periodicity_and_start_slot_r17_c::scs30_c_");
  }
  j.end_obj();
}
SRSASN_CODE dl_ppw_periodicity_and_start_slot_r17_c::scs30_c_::pack(bit_ref& bref) const
{
  type_.pack(bref);
  switch (type_) {
    case types::n8:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)7u));
      break;
    case types::n10:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)9u));
      break;
    case types::n16:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)15u));
      break;
    case types::n20:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)19u));
      break;
    case types::n32:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)31u));
      break;
    case types::n40:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)39u));
      break;
    case types::n64:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)63u));
      break;
    case types::n80:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)79u));
      break;
    case types::n128:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)127u));
      break;
    case types::n160:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)159u));
      break;
    case types::n320:
      HANDLE_CODE(pack_integer(bref, c.get<uint16_t>(), (uint16_t)0u, (uint16_t)319u));
      break;
    case types::n640:
      HANDLE_CODE(pack_integer(bref, c.get<uint16_t>(), (uint16_t)0u, (uint16_t)639u));
      break;
    case types::n1280:
      HANDLE_CODE(pack_integer(bref, c.get<uint16_t>(), (uint16_t)0u, (uint16_t)1279u));
      break;
    case types::n2560:
      HANDLE_CODE(pack_integer(bref, c.get<uint16_t>(), (uint16_t)0u, (uint16_t)2559u));
      break;
    case types::n5120:
      HANDLE_CODE(pack_integer(bref, c.get<uint16_t>(), (uint16_t)0u, (uint16_t)5119u));
      break;
    case types::n10240:
      HANDLE_CODE(pack_integer(bref, c.get<uint16_t>(), (uint16_t)0u, (uint16_t)10239u));
      break;
    case types::n20480:
      HANDLE_CODE(pack_integer(bref, c.get<uint16_t>(), (uint16_t)0u, (uint16_t)20479u));
      break;
    default:
      log_invalid_choice_id(type_, "dl_ppw_periodicity_and_start_slot_r17_c::scs30_c_");
      return SRSASN_ERROR_ENCODE_FAIL;
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE dl_ppw_periodicity_and_start_slot_r17_c::scs30_c_::unpack(cbit_ref& bref)
{
  types e;
  e.unpack(bref);
  set(e);
  switch (type_) {
    case types::n8:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)7u));
      break;
    case types::n10:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)9u));
      break;
    case types::n16:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)15u));
      break;
    case types::n20:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)19u));
      break;
    case types::n32:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)31u));
      break;
    case types::n40:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)39u));
      break;
    case types::n64:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)63u));
      break;
    case types::n80:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)79u));
      break;
    case types::n128:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)127u));
      break;
    case types::n160:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)159u));
      break;
    case types::n320:
      HANDLE_CODE(unpack_integer(c.get<uint16_t>(), bref, (uint16_t)0u, (uint16_t)319u));
      break;
    case types::n640:
      HANDLE_CODE(unpack_integer(c.get<uint16_t>(), bref, (uint16_t)0u, (uint16_t)639u));
      break;
    case types::n1280:
      HANDLE_CODE(unpack_integer(c.get<uint16_t>(), bref, (uint16_t)0u, (uint16_t)1279u));
      break;
    case types::n2560:
      HANDLE_CODE(unpack_integer(c.get<uint16_t>(), bref, (uint16_t)0u, (uint16_t)2559u));
      break;
    case types::n5120:
      HANDLE_CODE(unpack_integer(c.get<uint16_t>(), bref, (uint16_t)0u, (uint16_t)5119u));
      break;
    case types::n10240:
      HANDLE_CODE(unpack_integer(c.get<uint16_t>(), bref, (uint16_t)0u, (uint16_t)10239u));
      break;
    case types::n20480:
      HANDLE_CODE(unpack_integer(c.get<uint16_t>(), bref, (uint16_t)0u, (uint16_t)20479u));
      break;
    default:
      log_invalid_choice_id(type_, "dl_ppw_periodicity_and_start_slot_r17_c::scs30_c_");
      return SRSASN_ERROR_DECODE_FAIL;
  }
  return SRSASN_SUCCESS;
}

const char* dl_ppw_periodicity_and_start_slot_r17_c::scs30_c_::types_opts::to_string() const
{
  static const char* names[] = {"n8",
                                "n10",
                                "n16",
                                "n20",
                                "n32",
                                "n40",
                                "n64",
                                "n80",
                                "n128",
                                "n160",
                                "n320",
                                "n640",
                                "n1280",
                                "n2560",
                                "n5120",
                                "n10240",
                                "n20480"};
  return convert_enum_idx(names, 17, value, "dl_ppw_periodicity_and_start_slot_r17_c::scs30_c_::types");
}
uint16_t dl_ppw_periodicity_and_start_slot_r17_c::scs30_c_::types_opts::to_number() const
{
  static const uint16_t numbers[] = {8, 10, 16, 20, 32, 40, 64, 80, 128, 160, 320, 640, 1280, 2560, 5120, 10240, 20480};
  return map_enum_number(numbers, 17, value, "dl_ppw_periodicity_and_start_slot_r17_c::scs30_c_::types");
}

void dl_ppw_periodicity_and_start_slot_r17_c::scs60_c_::destroy_() {}
void dl_ppw_periodicity_and_start_slot_r17_c::scs60_c_::set(types::options e)
{
  destroy_();
  type_ = e;
}
dl_ppw_periodicity_and_start_slot_r17_c::scs60_c_::scs60_c_(
    const dl_ppw_periodicity_and_start_slot_r17_c::scs60_c_& other)
{
  type_ = other.type();
  switch (type_) {
    case types::n16:
      c.init(other.c.get<uint8_t>());
      break;
    case types::n20:
      c.init(other.c.get<uint8_t>());
      break;
    case types::n32:
      c.init(other.c.get<uint8_t>());
      break;
    case types::n40:
      c.init(other.c.get<uint8_t>());
      break;
    case types::n64:
      c.init(other.c.get<uint8_t>());
      break;
    case types::n80:
      c.init(other.c.get<uint8_t>());
      break;
    case types::n128:
      c.init(other.c.get<uint8_t>());
      break;
    case types::n160:
      c.init(other.c.get<uint8_t>());
      break;
    case types::n256:
      c.init(other.c.get<uint16_t>());
      break;
    case types::n320:
      c.init(other.c.get<uint16_t>());
      break;
    case types::n640:
      c.init(other.c.get<uint16_t>());
      break;
    case types::n1280:
      c.init(other.c.get<uint16_t>());
      break;
    case types::n2560:
      c.init(other.c.get<uint16_t>());
      break;
    case types::n5120:
      c.init(other.c.get<uint16_t>());
      break;
    case types::n10240:
      c.init(other.c.get<uint16_t>());
      break;
    case types::n20480:
      c.init(other.c.get<uint16_t>());
      break;
    case types::n40960:
      c.init(other.c.get<uint16_t>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "dl_ppw_periodicity_and_start_slot_r17_c::scs60_c_");
  }
}
dl_ppw_periodicity_and_start_slot_r17_c::scs60_c_& dl_ppw_periodicity_and_start_slot_r17_c::scs60_c_::operator=(
    const dl_ppw_periodicity_and_start_slot_r17_c::scs60_c_& other)
{
  if (this == &other) {
    return *this;
  }
  set(other.type());
  switch (type_) {
    case types::n16:
      c.set(other.c.get<uint8_t>());
      break;
    case types::n20:
      c.set(other.c.get<uint8_t>());
      break;
    case types::n32:
      c.set(other.c.get<uint8_t>());
      break;
    case types::n40:
      c.set(other.c.get<uint8_t>());
      break;
    case types::n64:
      c.set(other.c.get<uint8_t>());
      break;
    case types::n80:
      c.set(other.c.get<uint8_t>());
      break;
    case types::n128:
      c.set(other.c.get<uint8_t>());
      break;
    case types::n160:
      c.set(other.c.get<uint8_t>());
      break;
    case types::n256:
      c.set(other.c.get<uint16_t>());
      break;
    case types::n320:
      c.set(other.c.get<uint16_t>());
      break;
    case types::n640:
      c.set(other.c.get<uint16_t>());
      break;
    case types::n1280:
      c.set(other.c.get<uint16_t>());
      break;
    case types::n2560:
      c.set(other.c.get<uint16_t>());
      break;
    case types::n5120:
      c.set(other.c.get<uint16_t>());
      break;
    case types::n10240:
      c.set(other.c.get<uint16_t>());
      break;
    case types::n20480:
      c.set(other.c.get<uint16_t>());
      break;
    case types::n40960:
      c.set(other.c.get<uint16_t>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "dl_ppw_periodicity_and_start_slot_r17_c::scs60_c_");
  }

  return *this;
}
uint8_t& dl_ppw_periodicity_and_start_slot_r17_c::scs60_c_::set_n16()
{
  set(types::n16);
  return c.get<uint8_t>();
}
uint8_t& dl_ppw_periodicity_and_start_slot_r17_c::scs60_c_::set_n20()
{
  set(types::n20);
  return c.get<uint8_t>();
}
uint8_t& dl_ppw_periodicity_and_start_slot_r17_c::scs60_c_::set_n32()
{
  set(types::n32);
  return c.get<uint8_t>();
}
uint8_t& dl_ppw_periodicity_and_start_slot_r17_c::scs60_c_::set_n40()
{
  set(types::n40);
  return c.get<uint8_t>();
}
uint8_t& dl_ppw_periodicity_and_start_slot_r17_c::scs60_c_::set_n64()
{
  set(types::n64);
  return c.get<uint8_t>();
}
uint8_t& dl_ppw_periodicity_and_start_slot_r17_c::scs60_c_::set_n80()
{
  set(types::n80);
  return c.get<uint8_t>();
}
uint8_t& dl_ppw_periodicity_and_start_slot_r17_c::scs60_c_::set_n128()
{
  set(types::n128);
  return c.get<uint8_t>();
}
uint8_t& dl_ppw_periodicity_and_start_slot_r17_c::scs60_c_::set_n160()
{
  set(types::n160);
  return c.get<uint8_t>();
}
uint16_t& dl_ppw_periodicity_and_start_slot_r17_c::scs60_c_::set_n256()
{
  set(types::n256);
  return c.get<uint16_t>();
}
uint16_t& dl_ppw_periodicity_and_start_slot_r17_c::scs60_c_::set_n320()
{
  set(types::n320);
  return c.get<uint16_t>();
}
uint16_t& dl_ppw_periodicity_and_start_slot_r17_c::scs60_c_::set_n640()
{
  set(types::n640);
  return c.get<uint16_t>();
}
uint16_t& dl_ppw_periodicity_and_start_slot_r17_c::scs60_c_::set_n1280()
{
  set(types::n1280);
  return c.get<uint16_t>();
}
uint16_t& dl_ppw_periodicity_and_start_slot_r17_c::scs60_c_::set_n2560()
{
  set(types::n2560);
  return c.get<uint16_t>();
}
uint16_t& dl_ppw_periodicity_and_start_slot_r17_c::scs60_c_::set_n5120()
{
  set(types::n5120);
  return c.get<uint16_t>();
}
uint16_t& dl_ppw_periodicity_and_start_slot_r17_c::scs60_c_::set_n10240()
{
  set(types::n10240);
  return c.get<uint16_t>();
}
uint16_t& dl_ppw_periodicity_and_start_slot_r17_c::scs60_c_::set_n20480()
{
  set(types::n20480);
  return c.get<uint16_t>();
}
uint16_t& dl_ppw_periodicity_and_start_slot_r17_c::scs60_c_::set_n40960()
{
  set(types::n40960);
  return c.get<uint16_t>();
}
void dl_ppw_periodicity_and_start_slot_r17_c::scs60_c_::to_json(json_writer& j) const
{
  j.start_obj();
  switch (type_) {
    case types::n16:
      j.write_int("n16", c.get<uint8_t>());
      break;
    case types::n20:
      j.write_int("n20", c.get<uint8_t>());
      break;
    case types::n32:
      j.write_int("n32", c.get<uint8_t>());
      break;
    case types::n40:
      j.write_int("n40", c.get<uint8_t>());
      break;
    case types::n64:
      j.write_int("n64", c.get<uint8_t>());
      break;
    case types::n80:
      j.write_int("n80", c.get<uint8_t>());
      break;
    case types::n128:
      j.write_int("n128", c.get<uint8_t>());
      break;
    case types::n160:
      j.write_int("n160", c.get<uint8_t>());
      break;
    case types::n256:
      j.write_int("n256", c.get<uint16_t>());
      break;
    case types::n320:
      j.write_int("n320", c.get<uint16_t>());
      break;
    case types::n640:
      j.write_int("n640", c.get<uint16_t>());
      break;
    case types::n1280:
      j.write_int("n1280", c.get<uint16_t>());
      break;
    case types::n2560:
      j.write_int("n2560", c.get<uint16_t>());
      break;
    case types::n5120:
      j.write_int("n5120", c.get<uint16_t>());
      break;
    case types::n10240:
      j.write_int("n10240", c.get<uint16_t>());
      break;
    case types::n20480:
      j.write_int("n20480", c.get<uint16_t>());
      break;
    case types::n40960:
      j.write_int("n40960", c.get<uint16_t>());
      break;
    default:
      log_invalid_choice_id(type_, "dl_ppw_periodicity_and_start_slot_r17_c::scs60_c_");
  }
  j.end_obj();
}
SRSASN_CODE dl_ppw_periodicity_and_start_slot_r17_c::scs60_c_::pack(bit_ref& bref) const
{
  type_.pack(bref);
  switch (type_) {
    case types::n16:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)15u));
      break;
    case types::n20:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)19u));
      break;
    case types::n32:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)31u));
      break;
    case types::n40:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)39u));
      break;
    case types::n64:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)63u));
      break;
    case types::n80:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)79u));
      break;
    case types::n128:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)127u));
      break;
    case types::n160:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)159u));
      break;
    case types::n256:
      HANDLE_CODE(pack_integer(bref, c.get<uint16_t>(), (uint16_t)0u, (uint16_t)255u));
      break;
    case types::n320:
      HANDLE_CODE(pack_integer(bref, c.get<uint16_t>(), (uint16_t)0u, (uint16_t)319u));
      break;
    case types::n640:
      HANDLE_CODE(pack_integer(bref, c.get<uint16_t>(), (uint16_t)0u, (uint16_t)639u));
      break;
    case types::n1280:
      HANDLE_CODE(pack_integer(bref, c.get<uint16_t>(), (uint16_t)0u, (uint16_t)1279u));
      break;
    case types::n2560:
      HANDLE_CODE(pack_integer(bref, c.get<uint16_t>(), (uint16_t)0u, (uint16_t)2559u));
      break;
    case types::n5120:
      HANDLE_CODE(pack_integer(bref, c.get<uint16_t>(), (uint16_t)0u, (uint16_t)5119u));
      break;
    case types::n10240:
      HANDLE_CODE(pack_integer(bref, c.get<uint16_t>(), (uint16_t)0u, (uint16_t)10239u));
      break;
    case types::n20480:
      HANDLE_CODE(pack_integer(bref, c.get<uint16_t>(), (uint16_t)0u, (uint16_t)20479u));
      break;
    case types::n40960:
      HANDLE_CODE(pack_integer(bref, c.get<uint16_t>(), (uint16_t)0u, (uint16_t)40959u));
      break;
    default:
      log_invalid_choice_id(type_, "dl_ppw_periodicity_and_start_slot_r17_c::scs60_c_");
      return SRSASN_ERROR_ENCODE_FAIL;
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE dl_ppw_periodicity_and_start_slot_r17_c::scs60_c_::unpack(cbit_ref& bref)
{
  types e;
  e.unpack(bref);
  set(e);
  switch (type_) {
    case types::n16:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)15u));
      break;
    case types::n20:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)19u));
      break;
    case types::n32:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)31u));
      break;
    case types::n40:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)39u));
      break;
    case types::n64:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)63u));
      break;
    case types::n80:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)79u));
      break;
    case types::n128:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)127u));
      break;
    case types::n160:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)159u));
      break;
    case types::n256:
      HANDLE_CODE(unpack_integer(c.get<uint16_t>(), bref, (uint16_t)0u, (uint16_t)255u));
      break;
    case types::n320:
      HANDLE_CODE(unpack_integer(c.get<uint16_t>(), bref, (uint16_t)0u, (uint16_t)319u));
      break;
    case types::n640:
      HANDLE_CODE(unpack_integer(c.get<uint16_t>(), bref, (uint16_t)0u, (uint16_t)639u));
      break;
    case types::n1280:
      HANDLE_CODE(unpack_integer(c.get<uint16_t>(), bref, (uint16_t)0u, (uint16_t)1279u));
      break;
    case types::n2560:
      HANDLE_CODE(unpack_integer(c.get<uint16_t>(), bref, (uint16_t)0u, (uint16_t)2559u));
      break;
    case types::n5120:
      HANDLE_CODE(unpack_integer(c.get<uint16_t>(), bref, (uint16_t)0u, (uint16_t)5119u));
      break;
    case types::n10240:
      HANDLE_CODE(unpack_integer(c.get<uint16_t>(), bref, (uint16_t)0u, (uint16_t)10239u));
      break;
    case types::n20480:
      HANDLE_CODE(unpack_integer(c.get<uint16_t>(), bref, (uint16_t)0u, (uint16_t)20479u));
      break;
    case types::n40960:
      HANDLE_CODE(unpack_integer(c.get<uint16_t>(), bref, (uint16_t)0u, (uint16_t)40959u));
      break;
    default:
      log_invalid_choice_id(type_, "dl_ppw_periodicity_and_start_slot_r17_c::scs60_c_");
      return SRSASN_ERROR_DECODE_FAIL;
  }
  return SRSASN_SUCCESS;
}

const char* dl_ppw_periodicity_and_start_slot_r17_c::scs60_c_::types_opts::to_string() const
{
  static const char* names[] = {"n16",
                                "n20",
                                "n32",
                                "n40",
                                "n64",
                                "n80",
                                "n128",
                                "n160",
                                "n256",
                                "n320",
                                "n640",
                                "n1280",
                                "n2560",
                                "n5120",
                                "n10240",
                                "n20480",
                                "n40960"};
  return convert_enum_idx(names, 17, value, "dl_ppw_periodicity_and_start_slot_r17_c::scs60_c_::types");
}
uint16_t dl_ppw_periodicity_and_start_slot_r17_c::scs60_c_::types_opts::to_number() const
{
  static const uint16_t numbers[] = {
      16, 20, 32, 40, 64, 80, 128, 160, 256, 320, 640, 1280, 2560, 5120, 10240, 20480, 40960};
  return map_enum_number(numbers, 17, value, "dl_ppw_periodicity_and_start_slot_r17_c::scs60_c_::types");
}

void dl_ppw_periodicity_and_start_slot_r17_c::scs120_c_::destroy_() {}
void dl_ppw_periodicity_and_start_slot_r17_c::scs120_c_::set(types::options e)
{
  destroy_();
  type_ = e;
}
dl_ppw_periodicity_and_start_slot_r17_c::scs120_c_::scs120_c_(
    const dl_ppw_periodicity_and_start_slot_r17_c::scs120_c_& other)
{
  type_ = other.type();
  switch (type_) {
    case types::n32:
      c.init(other.c.get<uint8_t>());
      break;
    case types::n40:
      c.init(other.c.get<uint8_t>());
      break;
    case types::n64:
      c.init(other.c.get<uint8_t>());
      break;
    case types::n80:
      c.init(other.c.get<uint8_t>());
      break;
    case types::n128:
      c.init(other.c.get<uint8_t>());
      break;
    case types::n160:
      c.init(other.c.get<uint8_t>());
      break;
    case types::n256:
      c.init(other.c.get<uint16_t>());
      break;
    case types::n320:
      c.init(other.c.get<uint16_t>());
      break;
    case types::n512:
      c.init(other.c.get<uint16_t>());
      break;
    case types::n640:
      c.init(other.c.get<uint16_t>());
      break;
    case types::n1280:
      c.init(other.c.get<uint16_t>());
      break;
    case types::n2560:
      c.init(other.c.get<uint16_t>());
      break;
    case types::n5120:
      c.init(other.c.get<uint16_t>());
      break;
    case types::n10240:
      c.init(other.c.get<uint16_t>());
      break;
    case types::n20480:
      c.init(other.c.get<uint16_t>());
      break;
    case types::n40960:
      c.init(other.c.get<uint16_t>());
      break;
    case types::n81920:
      c.init(other.c.get<uint32_t>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "dl_ppw_periodicity_and_start_slot_r17_c::scs120_c_");
  }
}
dl_ppw_periodicity_and_start_slot_r17_c::scs120_c_& dl_ppw_periodicity_and_start_slot_r17_c::scs120_c_::operator=(
    const dl_ppw_periodicity_and_start_slot_r17_c::scs120_c_& other)
{
  if (this == &other) {
    return *this;
  }
  set(other.type());
  switch (type_) {
    case types::n32:
      c.set(other.c.get<uint8_t>());
      break;
    case types::n40:
      c.set(other.c.get<uint8_t>());
      break;
    case types::n64:
      c.set(other.c.get<uint8_t>());
      break;
    case types::n80:
      c.set(other.c.get<uint8_t>());
      break;
    case types::n128:
      c.set(other.c.get<uint8_t>());
      break;
    case types::n160:
      c.set(other.c.get<uint8_t>());
      break;
    case types::n256:
      c.set(other.c.get<uint16_t>());
      break;
    case types::n320:
      c.set(other.c.get<uint16_t>());
      break;
    case types::n512:
      c.set(other.c.get<uint16_t>());
      break;
    case types::n640:
      c.set(other.c.get<uint16_t>());
      break;
    case types::n1280:
      c.set(other.c.get<uint16_t>());
      break;
    case types::n2560:
      c.set(other.c.get<uint16_t>());
      break;
    case types::n5120:
      c.set(other.c.get<uint16_t>());
      break;
    case types::n10240:
      c.set(other.c.get<uint16_t>());
      break;
    case types::n20480:
      c.set(other.c.get<uint16_t>());
      break;
    case types::n40960:
      c.set(other.c.get<uint16_t>());
      break;
    case types::n81920:
      c.set(other.c.get<uint32_t>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "dl_ppw_periodicity_and_start_slot_r17_c::scs120_c_");
  }

  return *this;
}
uint8_t& dl_ppw_periodicity_and_start_slot_r17_c::scs120_c_::set_n32()
{
  set(types::n32);
  return c.get<uint8_t>();
}
uint8_t& dl_ppw_periodicity_and_start_slot_r17_c::scs120_c_::set_n40()
{
  set(types::n40);
  return c.get<uint8_t>();
}
uint8_t& dl_ppw_periodicity_and_start_slot_r17_c::scs120_c_::set_n64()
{
  set(types::n64);
  return c.get<uint8_t>();
}
uint8_t& dl_ppw_periodicity_and_start_slot_r17_c::scs120_c_::set_n80()
{
  set(types::n80);
  return c.get<uint8_t>();
}
uint8_t& dl_ppw_periodicity_and_start_slot_r17_c::scs120_c_::set_n128()
{
  set(types::n128);
  return c.get<uint8_t>();
}
uint8_t& dl_ppw_periodicity_and_start_slot_r17_c::scs120_c_::set_n160()
{
  set(types::n160);
  return c.get<uint8_t>();
}
uint16_t& dl_ppw_periodicity_and_start_slot_r17_c::scs120_c_::set_n256()
{
  set(types::n256);
  return c.get<uint16_t>();
}
uint16_t& dl_ppw_periodicity_and_start_slot_r17_c::scs120_c_::set_n320()
{
  set(types::n320);
  return c.get<uint16_t>();
}
uint16_t& dl_ppw_periodicity_and_start_slot_r17_c::scs120_c_::set_n512()
{
  set(types::n512);
  return c.get<uint16_t>();
}
uint16_t& dl_ppw_periodicity_and_start_slot_r17_c::scs120_c_::set_n640()
{
  set(types::n640);
  return c.get<uint16_t>();
}
uint16_t& dl_ppw_periodicity_and_start_slot_r17_c::scs120_c_::set_n1280()
{
  set(types::n1280);
  return c.get<uint16_t>();
}
uint16_t& dl_ppw_periodicity_and_start_slot_r17_c::scs120_c_::set_n2560()
{
  set(types::n2560);
  return c.get<uint16_t>();
}
uint16_t& dl_ppw_periodicity_and_start_slot_r17_c::scs120_c_::set_n5120()
{
  set(types::n5120);
  return c.get<uint16_t>();
}
uint16_t& dl_ppw_periodicity_and_start_slot_r17_c::scs120_c_::set_n10240()
{
  set(types::n10240);
  return c.get<uint16_t>();
}
uint16_t& dl_ppw_periodicity_and_start_slot_r17_c::scs120_c_::set_n20480()
{
  set(types::n20480);
  return c.get<uint16_t>();
}
uint16_t& dl_ppw_periodicity_and_start_slot_r17_c::scs120_c_::set_n40960()
{
  set(types::n40960);
  return c.get<uint16_t>();
}
uint32_t& dl_ppw_periodicity_and_start_slot_r17_c::scs120_c_::set_n81920()
{
  set(types::n81920);
  return c.get<uint32_t>();
}
void dl_ppw_periodicity_and_start_slot_r17_c::scs120_c_::to_json(json_writer& j) const
{
  j.start_obj();
  switch (type_) {
    case types::n32:
      j.write_int("n32", c.get<uint8_t>());
      break;
    case types::n40:
      j.write_int("n40", c.get<uint8_t>());
      break;
    case types::n64:
      j.write_int("n64", c.get<uint8_t>());
      break;
    case types::n80:
      j.write_int("n80", c.get<uint8_t>());
      break;
    case types::n128:
      j.write_int("n128", c.get<uint8_t>());
      break;
    case types::n160:
      j.write_int("n160", c.get<uint8_t>());
      break;
    case types::n256:
      j.write_int("n256", c.get<uint16_t>());
      break;
    case types::n320:
      j.write_int("n320", c.get<uint16_t>());
      break;
    case types::n512:
      j.write_int("n512", c.get<uint16_t>());
      break;
    case types::n640:
      j.write_int("n640", c.get<uint16_t>());
      break;
    case types::n1280:
      j.write_int("n1280", c.get<uint16_t>());
      break;
    case types::n2560:
      j.write_int("n2560", c.get<uint16_t>());
      break;
    case types::n5120:
      j.write_int("n5120", c.get<uint16_t>());
      break;
    case types::n10240:
      j.write_int("n10240", c.get<uint16_t>());
      break;
    case types::n20480:
      j.write_int("n20480", c.get<uint16_t>());
      break;
    case types::n40960:
      j.write_int("n40960", c.get<uint16_t>());
      break;
    case types::n81920:
      j.write_int("n81920", c.get<uint32_t>());
      break;
    default:
      log_invalid_choice_id(type_, "dl_ppw_periodicity_and_start_slot_r17_c::scs120_c_");
  }
  j.end_obj();
}
SRSASN_CODE dl_ppw_periodicity_and_start_slot_r17_c::scs120_c_::pack(bit_ref& bref) const
{
  type_.pack(bref);
  switch (type_) {
    case types::n32:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)31u));
      break;
    case types::n40:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)39u));
      break;
    case types::n64:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)63u));
      break;
    case types::n80:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)79u));
      break;
    case types::n128:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)127u));
      break;
    case types::n160:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)159u));
      break;
    case types::n256:
      HANDLE_CODE(pack_integer(bref, c.get<uint16_t>(), (uint16_t)0u, (uint16_t)255u));
      break;
    case types::n320:
      HANDLE_CODE(pack_integer(bref, c.get<uint16_t>(), (uint16_t)0u, (uint16_t)319u));
      break;
    case types::n512:
      HANDLE_CODE(pack_integer(bref, c.get<uint16_t>(), (uint16_t)0u, (uint16_t)511u));
      break;
    case types::n640:
      HANDLE_CODE(pack_integer(bref, c.get<uint16_t>(), (uint16_t)0u, (uint16_t)639u));
      break;
    case types::n1280:
      HANDLE_CODE(pack_integer(bref, c.get<uint16_t>(), (uint16_t)0u, (uint16_t)1279u));
      break;
    case types::n2560:
      HANDLE_CODE(pack_integer(bref, c.get<uint16_t>(), (uint16_t)0u, (uint16_t)2559u));
      break;
    case types::n5120:
      HANDLE_CODE(pack_integer(bref, c.get<uint16_t>(), (uint16_t)0u, (uint16_t)5119u));
      break;
    case types::n10240:
      HANDLE_CODE(pack_integer(bref, c.get<uint16_t>(), (uint16_t)0u, (uint16_t)10239u));
      break;
    case types::n20480:
      HANDLE_CODE(pack_integer(bref, c.get<uint16_t>(), (uint16_t)0u, (uint16_t)20479u));
      break;
    case types::n40960:
      HANDLE_CODE(pack_integer(bref, c.get<uint16_t>(), (uint16_t)0u, (uint16_t)40959u));
      break;
    case types::n81920:
      HANDLE_CODE(pack_integer(bref, c.get<uint32_t>(), (uint32_t)0u, (uint32_t)81919u));
      break;
    default:
      log_invalid_choice_id(type_, "dl_ppw_periodicity_and_start_slot_r17_c::scs120_c_");
      return SRSASN_ERROR_ENCODE_FAIL;
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE dl_ppw_periodicity_and_start_slot_r17_c::scs120_c_::unpack(cbit_ref& bref)
{
  types e;
  e.unpack(bref);
  set(e);
  switch (type_) {
    case types::n32:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)31u));
      break;
    case types::n40:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)39u));
      break;
    case types::n64:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)63u));
      break;
    case types::n80:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)79u));
      break;
    case types::n128:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)127u));
      break;
    case types::n160:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)159u));
      break;
    case types::n256:
      HANDLE_CODE(unpack_integer(c.get<uint16_t>(), bref, (uint16_t)0u, (uint16_t)255u));
      break;
    case types::n320:
      HANDLE_CODE(unpack_integer(c.get<uint16_t>(), bref, (uint16_t)0u, (uint16_t)319u));
      break;
    case types::n512:
      HANDLE_CODE(unpack_integer(c.get<uint16_t>(), bref, (uint16_t)0u, (uint16_t)511u));
      break;
    case types::n640:
      HANDLE_CODE(unpack_integer(c.get<uint16_t>(), bref, (uint16_t)0u, (uint16_t)639u));
      break;
    case types::n1280:
      HANDLE_CODE(unpack_integer(c.get<uint16_t>(), bref, (uint16_t)0u, (uint16_t)1279u));
      break;
    case types::n2560:
      HANDLE_CODE(unpack_integer(c.get<uint16_t>(), bref, (uint16_t)0u, (uint16_t)2559u));
      break;
    case types::n5120:
      HANDLE_CODE(unpack_integer(c.get<uint16_t>(), bref, (uint16_t)0u, (uint16_t)5119u));
      break;
    case types::n10240:
      HANDLE_CODE(unpack_integer(c.get<uint16_t>(), bref, (uint16_t)0u, (uint16_t)10239u));
      break;
    case types::n20480:
      HANDLE_CODE(unpack_integer(c.get<uint16_t>(), bref, (uint16_t)0u, (uint16_t)20479u));
      break;
    case types::n40960:
      HANDLE_CODE(unpack_integer(c.get<uint16_t>(), bref, (uint16_t)0u, (uint16_t)40959u));
      break;
    case types::n81920:
      HANDLE_CODE(unpack_integer(c.get<uint32_t>(), bref, (uint32_t)0u, (uint32_t)81919u));
      break;
    default:
      log_invalid_choice_id(type_, "dl_ppw_periodicity_and_start_slot_r17_c::scs120_c_");
      return SRSASN_ERROR_DECODE_FAIL;
  }
  return SRSASN_SUCCESS;
}

const char* dl_ppw_periodicity_and_start_slot_r17_c::scs120_c_::types_opts::to_string() const
{
  static const char* names[] = {"n32",
                                "n40",
                                "n64",
                                "n80",
                                "n128",
                                "n160",
                                "n256",
                                "n320",
                                "n512",
                                "n640",
                                "n1280",
                                "n2560",
                                "n5120",
                                "n10240",
                                "n20480",
                                "n40960",
                                "n81920"};
  return convert_enum_idx(names, 17, value, "dl_ppw_periodicity_and_start_slot_r17_c::scs120_c_::types");
}
uint32_t dl_ppw_periodicity_and_start_slot_r17_c::scs120_c_::types_opts::to_number() const
{
  static const uint32_t numbers[] = {
      32, 40, 64, 80, 128, 160, 256, 320, 512, 640, 1280, 2560, 5120, 10240, 20480, 40960, 81920};
  return map_enum_number(numbers, 17, value, "dl_ppw_periodicity_and_start_slot_r17_c::scs120_c_::types");
}

const char* dl_ppw_periodicity_and_start_slot_r17_c::types_opts::to_string() const
{
  static const char* names[] = {"scs15", "scs30", "scs60", "scs120"};
  return convert_enum_idx(names, 4, value, "dl_ppw_periodicity_and_start_slot_r17_c::types");
}
uint8_t dl_ppw_periodicity_and_start_slot_r17_c::types_opts::to_number() const
{
  static const uint8_t numbers[] = {15, 30, 60, 120};
  return map_enum_number(numbers, 4, value, "dl_ppw_periodicity_and_start_slot_r17_c::types");
}

// DMRS-DownlinkConfig ::= SEQUENCE
SRSASN_CODE dmrs_dl_cfg_s::pack(bit_ref& bref) const
{
  bref.pack(ext, 1);
  HANDLE_CODE(bref.pack(dmrs_type_present, 1));
  HANDLE_CODE(bref.pack(dmrs_add_position_present, 1));
  HANDLE_CODE(bref.pack(max_len_present, 1));
  HANDLE_CODE(bref.pack(scrambling_id0_present, 1));
  HANDLE_CODE(bref.pack(scrambling_id1_present, 1));
  HANDLE_CODE(bref.pack(phase_tracking_rs_present, 1));

  if (dmrs_add_position_present) {
    HANDLE_CODE(dmrs_add_position.pack(bref));
  }
  if (scrambling_id0_present) {
    HANDLE_CODE(pack_integer(bref, scrambling_id0, (uint32_t)0u, (uint32_t)65535u));
  }
  if (scrambling_id1_present) {
    HANDLE_CODE(pack_integer(bref, scrambling_id1, (uint32_t)0u, (uint32_t)65535u));
  }
  if (phase_tracking_rs_present) {
    HANDLE_CODE(phase_tracking_rs.pack(bref));
  }

  if (ext) {
    ext_groups_packer_guard group_flags;
    group_flags[0] |= dmrs_dl_r16_present;
    group_flags.pack(bref);

    if (group_flags[0]) {
      varlength_field_pack_guard varlen_scope(bref, false);

      HANDLE_CODE(bref.pack(dmrs_dl_r16_present, 1));
    }
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE dmrs_dl_cfg_s::unpack(cbit_ref& bref)
{
  bref.unpack(ext, 1);
  HANDLE_CODE(bref.unpack(dmrs_type_present, 1));
  HANDLE_CODE(bref.unpack(dmrs_add_position_present, 1));
  HANDLE_CODE(bref.unpack(max_len_present, 1));
  HANDLE_CODE(bref.unpack(scrambling_id0_present, 1));
  HANDLE_CODE(bref.unpack(scrambling_id1_present, 1));
  HANDLE_CODE(bref.unpack(phase_tracking_rs_present, 1));

  if (dmrs_add_position_present) {
    HANDLE_CODE(dmrs_add_position.unpack(bref));
  }
  if (scrambling_id0_present) {
    HANDLE_CODE(unpack_integer(scrambling_id0, bref, (uint32_t)0u, (uint32_t)65535u));
  }
  if (scrambling_id1_present) {
    HANDLE_CODE(unpack_integer(scrambling_id1, bref, (uint32_t)0u, (uint32_t)65535u));
  }
  if (phase_tracking_rs_present) {
    HANDLE_CODE(phase_tracking_rs.unpack(bref));
  }

  if (ext) {
    ext_groups_unpacker_guard group_flags(1);
    group_flags.unpack(bref);

    if (group_flags[0]) {
      varlength_field_unpack_guard varlen_scope(bref, false);

      HANDLE_CODE(bref.unpack(dmrs_dl_r16_present, 1));
    }
  }
  return SRSASN_SUCCESS;
}
void dmrs_dl_cfg_s::to_json(json_writer& j) const
{
  j.start_obj();
  if (dmrs_type_present) {
    j.write_str("dmrs-Type", "type2");
  }
  if (dmrs_add_position_present) {
    j.write_str("dmrs-AdditionalPosition", dmrs_add_position.to_string());
  }
  if (max_len_present) {
    j.write_str("maxLength", "len2");
  }
  if (scrambling_id0_present) {
    j.write_int("scramblingID0", scrambling_id0);
  }
  if (scrambling_id1_present) {
    j.write_int("scramblingID1", scrambling_id1);
  }
  if (phase_tracking_rs_present) {
    j.write_fieldname("phaseTrackingRS");
    phase_tracking_rs.to_json(j);
  }
  if (ext) {
    if (dmrs_dl_r16_present) {
      j.write_str("dmrs-Downlink-r16", "enabled");
    }
  }
  j.end_obj();
}

const char* dmrs_dl_cfg_s::dmrs_add_position_opts::to_string() const
{
  static const char* names[] = {"pos0", "pos1", "pos3"};
  return convert_enum_idx(names, 3, value, "dmrs_dl_cfg_s::dmrs_add_position_e_");
}
uint8_t dmrs_dl_cfg_s::dmrs_add_position_opts::to_number() const
{
  static const uint8_t numbers[] = {0, 1, 3};
  return map_enum_number(numbers, 3, value, "dmrs_dl_cfg_s::dmrs_add_position_e_");
}

// DownlinkPreemption ::= SEQUENCE
SRSASN_CODE dl_preemption_s::pack(bit_ref& bref) const
{
  bref.pack(ext, 1);
  HANDLE_CODE(pack_integer(bref, int_rnti, (uint32_t)0u, (uint32_t)65535u));
  HANDLE_CODE(time_freq_set.pack(bref));
  HANDLE_CODE(pack_integer(bref, dci_payload_size, (uint8_t)0u, (uint8_t)126u));
  HANDLE_CODE(pack_dyn_seq_of(bref, int_cfg_per_serving_cell, 1, 32));

  return SRSASN_SUCCESS;
}
SRSASN_CODE dl_preemption_s::unpack(cbit_ref& bref)
{
  bref.unpack(ext, 1);
  HANDLE_CODE(unpack_integer(int_rnti, bref, (uint32_t)0u, (uint32_t)65535u));
  HANDLE_CODE(time_freq_set.unpack(bref));
  HANDLE_CODE(unpack_integer(dci_payload_size, bref, (uint8_t)0u, (uint8_t)126u));
  HANDLE_CODE(unpack_dyn_seq_of(int_cfg_per_serving_cell, bref, 1, 32));

  return SRSASN_SUCCESS;
}
void dl_preemption_s::to_json(json_writer& j) const
{
  j.start_obj();
  j.write_int("int-RNTI", int_rnti);
  j.write_str("timeFrequencySet", time_freq_set.to_string());
  j.write_int("dci-PayloadSize", dci_payload_size);
  j.start_array("int-ConfigurationPerServingCell");
  for (const auto& e1 : int_cfg_per_serving_cell) {
    e1.to_json(j);
  }
  j.end_array();
  j.end_obj();
}

const char* dl_preemption_s::time_freq_set_opts::to_string() const
{
  static const char* names[] = {"set0", "set1"};
  return convert_enum_idx(names, 2, value, "dl_preemption_s::time_freq_set_e_");
}
uint8_t dl_preemption_s::time_freq_set_opts::to_number() const
{
  static const uint8_t numbers[] = {0, 1};
  return map_enum_number(numbers, 2, value, "dl_preemption_s::time_freq_set_e_");
}

// PUCCH-TPC-CommandConfig ::= SEQUENCE
SRSASN_CODE pucch_tpc_cmd_cfg_s::pack(bit_ref& bref) const
{
  bref.pack(ext, 1);
  HANDLE_CODE(bref.pack(tpc_idx_pcell_present, 1));
  HANDLE_CODE(bref.pack(tpc_idx_pucch_scell_present, 1));

  if (tpc_idx_pcell_present) {
    HANDLE_CODE(pack_integer(bref, tpc_idx_pcell, (uint8_t)1u, (uint8_t)15u));
  }
  if (tpc_idx_pucch_scell_present) {
    HANDLE_CODE(pack_integer(bref, tpc_idx_pucch_scell, (uint8_t)1u, (uint8_t)15u));
  }

  if (ext) {
    ext_groups_packer_guard group_flags;
    group_flags[0] |= tpc_idx_pucch_s_scell_r17_present;
    group_flags[0] |= tpc_idx_pucch_s_scell_secondary_pucch_group_r17_present;
    group_flags.pack(bref);

    if (group_flags[0]) {
      varlength_field_pack_guard varlen_scope(bref, false);

      HANDLE_CODE(bref.pack(tpc_idx_pucch_s_scell_r17_present, 1));
      HANDLE_CODE(bref.pack(tpc_idx_pucch_s_scell_secondary_pucch_group_r17_present, 1));
      if (tpc_idx_pucch_s_scell_r17_present) {
        HANDLE_CODE(pack_integer(bref, tpc_idx_pucch_s_scell_r17, (uint8_t)1u, (uint8_t)15u));
      }
      if (tpc_idx_pucch_s_scell_secondary_pucch_group_r17_present) {
        HANDLE_CODE(pack_integer(bref, tpc_idx_pucch_s_scell_secondary_pucch_group_r17, (uint8_t)1u, (uint8_t)15u));
      }
    }
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE pucch_tpc_cmd_cfg_s::unpack(cbit_ref& bref)
{
  bref.unpack(ext, 1);
  HANDLE_CODE(bref.unpack(tpc_idx_pcell_present, 1));
  HANDLE_CODE(bref.unpack(tpc_idx_pucch_scell_present, 1));

  if (tpc_idx_pcell_present) {
    HANDLE_CODE(unpack_integer(tpc_idx_pcell, bref, (uint8_t)1u, (uint8_t)15u));
  }
  if (tpc_idx_pucch_scell_present) {
    HANDLE_CODE(unpack_integer(tpc_idx_pucch_scell, bref, (uint8_t)1u, (uint8_t)15u));
  }

  if (ext) {
    ext_groups_unpacker_guard group_flags(1);
    group_flags.unpack(bref);

    if (group_flags[0]) {
      varlength_field_unpack_guard varlen_scope(bref, false);

      HANDLE_CODE(bref.unpack(tpc_idx_pucch_s_scell_r17_present, 1));
      HANDLE_CODE(bref.unpack(tpc_idx_pucch_s_scell_secondary_pucch_group_r17_present, 1));
      if (tpc_idx_pucch_s_scell_r17_present) {
        HANDLE_CODE(unpack_integer(tpc_idx_pucch_s_scell_r17, bref, (uint8_t)1u, (uint8_t)15u));
      }
      if (tpc_idx_pucch_s_scell_secondary_pucch_group_r17_present) {
        HANDLE_CODE(unpack_integer(tpc_idx_pucch_s_scell_secondary_pucch_group_r17, bref, (uint8_t)1u, (uint8_t)15u));
      }
    }
  }
  return SRSASN_SUCCESS;
}
void pucch_tpc_cmd_cfg_s::to_json(json_writer& j) const
{
  j.start_obj();
  if (tpc_idx_pcell_present) {
    j.write_int("tpc-IndexPCell", tpc_idx_pcell);
  }
  if (tpc_idx_pucch_scell_present) {
    j.write_int("tpc-IndexPUCCH-SCell", tpc_idx_pucch_scell);
  }
  if (ext) {
    if (tpc_idx_pucch_s_scell_r17_present) {
      j.write_int("tpc-IndexPUCCH-sSCell-r17", tpc_idx_pucch_s_scell_r17);
    }
    if (tpc_idx_pucch_s_scell_secondary_pucch_group_r17_present) {
      j.write_int("tpc-IndexPUCCH-sScellSecondaryPUCCHgroup-r17", tpc_idx_pucch_s_scell_secondary_pucch_group_r17);
    }
  }
  j.end_obj();
}

// PUSCH-TPC-CommandConfig ::= SEQUENCE
SRSASN_CODE pusch_tpc_cmd_cfg_s::pack(bit_ref& bref) const
{
  bref.pack(ext, 1);
  HANDLE_CODE(bref.pack(tpc_idx_present, 1));
  HANDLE_CODE(bref.pack(tpc_idx_sul_present, 1));
  HANDLE_CODE(bref.pack(target_cell_present, 1));

  if (tpc_idx_present) {
    HANDLE_CODE(pack_integer(bref, tpc_idx, (uint8_t)1u, (uint8_t)15u));
  }
  if (tpc_idx_sul_present) {
    HANDLE_CODE(pack_integer(bref, tpc_idx_sul, (uint8_t)1u, (uint8_t)15u));
  }
  if (target_cell_present) {
    HANDLE_CODE(pack_integer(bref, target_cell, (uint8_t)0u, (uint8_t)31u));
  }

  return SRSASN_SUCCESS;
}
SRSASN_CODE pusch_tpc_cmd_cfg_s::unpack(cbit_ref& bref)
{
  bref.unpack(ext, 1);
  HANDLE_CODE(bref.unpack(tpc_idx_present, 1));
  HANDLE_CODE(bref.unpack(tpc_idx_sul_present, 1));
  HANDLE_CODE(bref.unpack(target_cell_present, 1));

  if (tpc_idx_present) {
    HANDLE_CODE(unpack_integer(tpc_idx, bref, (uint8_t)1u, (uint8_t)15u));
  }
  if (tpc_idx_sul_present) {
    HANDLE_CODE(unpack_integer(tpc_idx_sul, bref, (uint8_t)1u, (uint8_t)15u));
  }
  if (target_cell_present) {
    HANDLE_CODE(unpack_integer(target_cell, bref, (uint8_t)0u, (uint8_t)31u));
  }

  return SRSASN_SUCCESS;
}
void pusch_tpc_cmd_cfg_s::to_json(json_writer& j) const
{
  j.start_obj();
  if (tpc_idx_present) {
    j.write_int("tpc-Index", tpc_idx);
  }
  if (tpc_idx_sul_present) {
    j.write_int("tpc-IndexSUL", tpc_idx_sul);
  }
  if (target_cell_present) {
    j.write_int("targetCell", target_cell);
  }
  j.end_obj();
}

void rate_match_pattern_group_item_c_::destroy_() {}
void rate_match_pattern_group_item_c_::set(types::options e)
{
  destroy_();
  type_ = e;
}
rate_match_pattern_group_item_c_::rate_match_pattern_group_item_c_(const rate_match_pattern_group_item_c_& other)
{
  type_ = other.type();
  switch (type_) {
    case types::cell_level:
      c.init(other.c.get<uint8_t>());
      break;
    case types::bwp_level:
      c.init(other.c.get<uint8_t>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "rate_match_pattern_group_item_c_");
  }
}
rate_match_pattern_group_item_c_&
rate_match_pattern_group_item_c_::operator=(const rate_match_pattern_group_item_c_& other)
{
  if (this == &other) {
    return *this;
  }
  set(other.type());
  switch (type_) {
    case types::cell_level:
      c.set(other.c.get<uint8_t>());
      break;
    case types::bwp_level:
      c.set(other.c.get<uint8_t>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "rate_match_pattern_group_item_c_");
  }

  return *this;
}
uint8_t& rate_match_pattern_group_item_c_::set_cell_level()
{
  set(types::cell_level);
  return c.get<uint8_t>();
}
uint8_t& rate_match_pattern_group_item_c_::set_bwp_level()
{
  set(types::bwp_level);
  return c.get<uint8_t>();
}
void rate_match_pattern_group_item_c_::to_json(json_writer& j) const
{
  j.start_obj();
  switch (type_) {
    case types::cell_level:
      j.write_int("cellLevel", c.get<uint8_t>());
      break;
    case types::bwp_level:
      j.write_int("bwpLevel", c.get<uint8_t>());
      break;
    default:
      log_invalid_choice_id(type_, "rate_match_pattern_group_item_c_");
  }
  j.end_obj();
}
SRSASN_CODE rate_match_pattern_group_item_c_::pack(bit_ref& bref) const
{
  type_.pack(bref);
  switch (type_) {
    case types::cell_level:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)3u));
      break;
    case types::bwp_level:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)3u));
      break;
    default:
      log_invalid_choice_id(type_, "rate_match_pattern_group_item_c_");
      return SRSASN_ERROR_ENCODE_FAIL;
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE rate_match_pattern_group_item_c_::unpack(cbit_ref& bref)
{
  types e;
  e.unpack(bref);
  set(e);
  switch (type_) {
    case types::cell_level:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)3u));
      break;
    case types::bwp_level:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)3u));
      break;
    default:
      log_invalid_choice_id(type_, "rate_match_pattern_group_item_c_");
      return SRSASN_ERROR_DECODE_FAIL;
  }
  return SRSASN_SUCCESS;
}

const char* rate_match_pattern_group_item_c_::types_opts::to_string() const
{
  static const char* names[] = {"cellLevel", "bwpLevel"};
  return convert_enum_idx(names, 2, value, "rate_match_pattern_group_item_c_::types");
}

// RepetitionSchemeConfig-r16 ::= CHOICE
void repeat_scheme_cfg_r16_c::destroy_()
{
  switch (type_) {
    case types::fdm_tdm_r16:
      c.destroy<setup_release_c<fdm_tdm_r16_s>>();
      break;
    case types::slot_based_r16:
      c.destroy<setup_release_c<slot_based_r16_s>>();
      break;
    default:
      break;
  }
}
void repeat_scheme_cfg_r16_c::set(types::options e)
{
  destroy_();
  type_ = e;
  switch (type_) {
    case types::fdm_tdm_r16:
      c.init<setup_release_c<fdm_tdm_r16_s>>();
      break;
    case types::slot_based_r16:
      c.init<setup_release_c<slot_based_r16_s>>();
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "repeat_scheme_cfg_r16_c");
  }
}
repeat_scheme_cfg_r16_c::repeat_scheme_cfg_r16_c(const repeat_scheme_cfg_r16_c& other)
{
  type_ = other.type();
  switch (type_) {
    case types::fdm_tdm_r16:
      c.init(other.c.get<setup_release_c<fdm_tdm_r16_s>>());
      break;
    case types::slot_based_r16:
      c.init(other.c.get<setup_release_c<slot_based_r16_s>>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "repeat_scheme_cfg_r16_c");
  }
}
repeat_scheme_cfg_r16_c& repeat_scheme_cfg_r16_c::operator=(const repeat_scheme_cfg_r16_c& other)
{
  if (this == &other) {
    return *this;
  }
  set(other.type());
  switch (type_) {
    case types::fdm_tdm_r16:
      c.set(other.c.get<setup_release_c<fdm_tdm_r16_s>>());
      break;
    case types::slot_based_r16:
      c.set(other.c.get<setup_release_c<slot_based_r16_s>>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "repeat_scheme_cfg_r16_c");
  }

  return *this;
}
setup_release_c<fdm_tdm_r16_s>& repeat_scheme_cfg_r16_c::set_fdm_tdm_r16()
{
  set(types::fdm_tdm_r16);
  return c.get<setup_release_c<fdm_tdm_r16_s>>();
}
setup_release_c<slot_based_r16_s>& repeat_scheme_cfg_r16_c::set_slot_based_r16()
{
  set(types::slot_based_r16);
  return c.get<setup_release_c<slot_based_r16_s>>();
}
void repeat_scheme_cfg_r16_c::to_json(json_writer& j) const
{
  j.start_obj();
  switch (type_) {
    case types::fdm_tdm_r16:
      j.write_fieldname("fdm-TDM-r16");
      c.get<setup_release_c<fdm_tdm_r16_s>>().to_json(j);
      break;
    case types::slot_based_r16:
      j.write_fieldname("slotBased-r16");
      c.get<setup_release_c<slot_based_r16_s>>().to_json(j);
      break;
    default:
      log_invalid_choice_id(type_, "repeat_scheme_cfg_r16_c");
  }
  j.end_obj();
}
SRSASN_CODE repeat_scheme_cfg_r16_c::pack(bit_ref& bref) const
{
  type_.pack(bref);
  switch (type_) {
    case types::fdm_tdm_r16:
      HANDLE_CODE(c.get<setup_release_c<fdm_tdm_r16_s>>().pack(bref));
      break;
    case types::slot_based_r16:
      HANDLE_CODE(c.get<setup_release_c<slot_based_r16_s>>().pack(bref));
      break;
    default:
      log_invalid_choice_id(type_, "repeat_scheme_cfg_r16_c");
      return SRSASN_ERROR_ENCODE_FAIL;
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE repeat_scheme_cfg_r16_c::unpack(cbit_ref& bref)
{
  types e;
  e.unpack(bref);
  set(e);
  switch (type_) {
    case types::fdm_tdm_r16:
      HANDLE_CODE(c.get<setup_release_c<fdm_tdm_r16_s>>().unpack(bref));
      break;
    case types::slot_based_r16:
      HANDLE_CODE(c.get<setup_release_c<slot_based_r16_s>>().unpack(bref));
      break;
    default:
      log_invalid_choice_id(type_, "repeat_scheme_cfg_r16_c");
      return SRSASN_ERROR_DECODE_FAIL;
  }
  return SRSASN_SUCCESS;
}

const char* repeat_scheme_cfg_r16_c::types_opts::to_string() const
{
  static const char* names[] = {"fdm-TDM-r16", "slotBased-r16"};
  return convert_enum_idx(names, 2, value, "repeat_scheme_cfg_r16_c::types");
}

// RepetitionSchemeConfig-v1630 ::= SEQUENCE
SRSASN_CODE repeat_scheme_cfg_v1630_s::pack(bit_ref& bref) const
{
  HANDLE_CODE(slot_based_v1630.pack(bref));

  return SRSASN_SUCCESS;
}
SRSASN_CODE repeat_scheme_cfg_v1630_s::unpack(cbit_ref& bref)
{
  HANDLE_CODE(slot_based_v1630.unpack(bref));

  return SRSASN_SUCCESS;
}
void repeat_scheme_cfg_v1630_s::to_json(json_writer& j) const
{
  j.start_obj();
  j.write_fieldname("slotBased-v1630");
  slot_based_v1630.to_json(j);
  j.end_obj();
}

// SPS-Config ::= SEQUENCE
SRSASN_CODE sps_cfg_s::pack(bit_ref& bref) const
{
  bref.pack(ext, 1);
  HANDLE_CODE(bref.pack(n1_pucch_an_present, 1));
  HANDLE_CODE(bref.pack(mcs_table_present, 1));

  HANDLE_CODE(periodicity.pack(bref));
  HANDLE_CODE(pack_integer(bref, nrof_harq_processes, (uint8_t)1u, (uint8_t)8u));
  if (n1_pucch_an_present) {
    HANDLE_CODE(pack_integer(bref, n1_pucch_an, (uint8_t)0u, (uint8_t)127u));
  }

  if (ext) {
    ext_groups_packer_guard group_flags;
    group_flags[0] |= sps_cfg_idx_r16_present;
    group_flags[0] |= harq_proc_id_offset_r16_present;
    group_flags[0] |= periodicity_ext_r16_present;
    group_flags[0] |= harq_codebook_id_r16_present;
    group_flags[0] |= pdsch_aggregation_factor_r16_present;
    group_flags[1] |= sps_harq_deferral_r17_present;
    group_flags[1] |= n1_pucch_an_pucch_s_scell_r17_present;
    group_flags[1] |= periodicity_ext_r17_present;
    group_flags[1] |= nrof_harq_processes_v1710_present;
    group_flags[1] |= harq_proc_id_offset_v1700_present;
    group_flags.pack(bref);

    if (group_flags[0]) {
      varlength_field_pack_guard varlen_scope(bref, false);

      HANDLE_CODE(bref.pack(sps_cfg_idx_r16_present, 1));
      HANDLE_CODE(bref.pack(harq_proc_id_offset_r16_present, 1));
      HANDLE_CODE(bref.pack(periodicity_ext_r16_present, 1));
      HANDLE_CODE(bref.pack(harq_codebook_id_r16_present, 1));
      HANDLE_CODE(bref.pack(pdsch_aggregation_factor_r16_present, 1));
      if (sps_cfg_idx_r16_present) {
        HANDLE_CODE(pack_integer(bref, sps_cfg_idx_r16, (uint8_t)0u, (uint8_t)7u));
      }
      if (harq_proc_id_offset_r16_present) {
        HANDLE_CODE(pack_integer(bref, harq_proc_id_offset_r16, (uint8_t)0u, (uint8_t)15u));
      }
      if (periodicity_ext_r16_present) {
        HANDLE_CODE(pack_integer(bref, periodicity_ext_r16, (uint16_t)1u, (uint16_t)5120u));
      }
      if (harq_codebook_id_r16_present) {
        HANDLE_CODE(pack_integer(bref, harq_codebook_id_r16, (uint8_t)1u, (uint8_t)2u));
      }
      if (pdsch_aggregation_factor_r16_present) {
        HANDLE_CODE(pdsch_aggregation_factor_r16.pack(bref));
      }
    }
    if (group_flags[1]) {
      varlength_field_pack_guard varlen_scope(bref, false);

      HANDLE_CODE(bref.pack(sps_harq_deferral_r17_present, 1));
      HANDLE_CODE(bref.pack(n1_pucch_an_pucch_s_scell_r17_present, 1));
      HANDLE_CODE(bref.pack(periodicity_ext_r17_present, 1));
      HANDLE_CODE(bref.pack(nrof_harq_processes_v1710_present, 1));
      HANDLE_CODE(bref.pack(harq_proc_id_offset_v1700_present, 1));
      if (sps_harq_deferral_r17_present) {
        HANDLE_CODE(pack_integer(bref, sps_harq_deferral_r17, (uint8_t)1u, (uint8_t)32u));
      }
      if (n1_pucch_an_pucch_s_scell_r17_present) {
        HANDLE_CODE(pack_integer(bref, n1_pucch_an_pucch_s_scell_r17, (uint8_t)0u, (uint8_t)127u));
      }
      if (periodicity_ext_r17_present) {
        HANDLE_CODE(pack_integer(bref, periodicity_ext_r17, (uint16_t)1u, (uint16_t)40960u));
      }
      if (nrof_harq_processes_v1710_present) {
        HANDLE_CODE(pack_integer(bref, nrof_harq_processes_v1710, (uint8_t)9u, (uint8_t)32u));
      }
      if (harq_proc_id_offset_v1700_present) {
        HANDLE_CODE(pack_integer(bref, harq_proc_id_offset_v1700, (uint8_t)16u, (uint8_t)31u));
      }
    }
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE sps_cfg_s::unpack(cbit_ref& bref)
{
  bref.unpack(ext, 1);
  HANDLE_CODE(bref.unpack(n1_pucch_an_present, 1));
  HANDLE_CODE(bref.unpack(mcs_table_present, 1));

  HANDLE_CODE(periodicity.unpack(bref));
  HANDLE_CODE(unpack_integer(nrof_harq_processes, bref, (uint8_t)1u, (uint8_t)8u));
  if (n1_pucch_an_present) {
    HANDLE_CODE(unpack_integer(n1_pucch_an, bref, (uint8_t)0u, (uint8_t)127u));
  }

  if (ext) {
    ext_groups_unpacker_guard group_flags(2);
    group_flags.unpack(bref);

    if (group_flags[0]) {
      varlength_field_unpack_guard varlen_scope(bref, false);

      HANDLE_CODE(bref.unpack(sps_cfg_idx_r16_present, 1));
      HANDLE_CODE(bref.unpack(harq_proc_id_offset_r16_present, 1));
      HANDLE_CODE(bref.unpack(periodicity_ext_r16_present, 1));
      HANDLE_CODE(bref.unpack(harq_codebook_id_r16_present, 1));
      HANDLE_CODE(bref.unpack(pdsch_aggregation_factor_r16_present, 1));
      if (sps_cfg_idx_r16_present) {
        HANDLE_CODE(unpack_integer(sps_cfg_idx_r16, bref, (uint8_t)0u, (uint8_t)7u));
      }
      if (harq_proc_id_offset_r16_present) {
        HANDLE_CODE(unpack_integer(harq_proc_id_offset_r16, bref, (uint8_t)0u, (uint8_t)15u));
      }
      if (periodicity_ext_r16_present) {
        HANDLE_CODE(unpack_integer(periodicity_ext_r16, bref, (uint16_t)1u, (uint16_t)5120u));
      }
      if (harq_codebook_id_r16_present) {
        HANDLE_CODE(unpack_integer(harq_codebook_id_r16, bref, (uint8_t)1u, (uint8_t)2u));
      }
      if (pdsch_aggregation_factor_r16_present) {
        HANDLE_CODE(pdsch_aggregation_factor_r16.unpack(bref));
      }
    }
    if (group_flags[1]) {
      varlength_field_unpack_guard varlen_scope(bref, false);

      HANDLE_CODE(bref.unpack(sps_harq_deferral_r17_present, 1));
      HANDLE_CODE(bref.unpack(n1_pucch_an_pucch_s_scell_r17_present, 1));
      HANDLE_CODE(bref.unpack(periodicity_ext_r17_present, 1));
      HANDLE_CODE(bref.unpack(nrof_harq_processes_v1710_present, 1));
      HANDLE_CODE(bref.unpack(harq_proc_id_offset_v1700_present, 1));
      if (sps_harq_deferral_r17_present) {
        HANDLE_CODE(unpack_integer(sps_harq_deferral_r17, bref, (uint8_t)1u, (uint8_t)32u));
      }
      if (n1_pucch_an_pucch_s_scell_r17_present) {
        HANDLE_CODE(unpack_integer(n1_pucch_an_pucch_s_scell_r17, bref, (uint8_t)0u, (uint8_t)127u));
      }
      if (periodicity_ext_r17_present) {
        HANDLE_CODE(unpack_integer(periodicity_ext_r17, bref, (uint16_t)1u, (uint16_t)40960u));
      }
      if (nrof_harq_processes_v1710_present) {
        HANDLE_CODE(unpack_integer(nrof_harq_processes_v1710, bref, (uint8_t)9u, (uint8_t)32u));
      }
      if (harq_proc_id_offset_v1700_present) {
        HANDLE_CODE(unpack_integer(harq_proc_id_offset_v1700, bref, (uint8_t)16u, (uint8_t)31u));
      }
    }
  }
  return SRSASN_SUCCESS;
}
void sps_cfg_s::to_json(json_writer& j) const
{
  j.start_obj();
  j.write_str("periodicity", periodicity.to_string());
  j.write_int("nrofHARQ-Processes", nrof_harq_processes);
  if (n1_pucch_an_present) {
    j.write_int("n1PUCCH-AN", n1_pucch_an);
  }
  if (mcs_table_present) {
    j.write_str("mcs-Table", "qam64LowSE");
  }
  if (ext) {
    if (sps_cfg_idx_r16_present) {
      j.write_int("sps-ConfigIndex-r16", sps_cfg_idx_r16);
    }
    if (harq_proc_id_offset_r16_present) {
      j.write_int("harq-ProcID-Offset-r16", harq_proc_id_offset_r16);
    }
    if (periodicity_ext_r16_present) {
      j.write_int("periodicityExt-r16", periodicity_ext_r16);
    }
    if (harq_codebook_id_r16_present) {
      j.write_int("harq-CodebookID-r16", harq_codebook_id_r16);
    }
    if (pdsch_aggregation_factor_r16_present) {
      j.write_str("pdsch-AggregationFactor-r16", pdsch_aggregation_factor_r16.to_string());
    }
    if (sps_harq_deferral_r17_present) {
      j.write_int("sps-HARQ-Deferral-r17", sps_harq_deferral_r17);
    }
    if (n1_pucch_an_pucch_s_scell_r17_present) {
      j.write_int("n1PUCCH-AN-PUCCHsSCell-r17", n1_pucch_an_pucch_s_scell_r17);
    }
    if (periodicity_ext_r17_present) {
      j.write_int("periodicityExt-r17", periodicity_ext_r17);
    }
    if (nrof_harq_processes_v1710_present) {
      j.write_int("nrofHARQ-Processes-v1710", nrof_harq_processes_v1710);
    }
    if (harq_proc_id_offset_v1700_present) {
      j.write_int("harq-ProcID-Offset-v1700", harq_proc_id_offset_v1700);
    }
  }
  j.end_obj();
}

const char* sps_cfg_s::periodicity_opts::to_string() const
{
  static const char* names[] = {"ms10",
                                "ms20",
                                "ms32",
                                "ms40",
                                "ms64",
                                "ms80",
                                "ms128",
                                "ms160",
                                "ms320",
                                "ms640",
                                "spare6",
                                "spare5",
                                "spare4",
                                "spare3",
                                "spare2",
                                "spare1"};
  return convert_enum_idx(names, 16, value, "sps_cfg_s::periodicity_e_");
}
uint16_t sps_cfg_s::periodicity_opts::to_number() const
{
  static const uint16_t numbers[] = {10, 20, 32, 40, 64, 80, 128, 160, 320, 640};
  return map_enum_number(numbers, 10, value, "sps_cfg_s::periodicity_e_");
}

const char* sps_cfg_s::pdsch_aggregation_factor_r16_opts::to_string() const
{
  static const char* names[] = {"n1", "n2", "n4", "n8"};
  return convert_enum_idx(names, 4, value, "sps_cfg_s::pdsch_aggregation_factor_r16_e_");
}
uint8_t sps_cfg_s::pdsch_aggregation_factor_r16_opts::to_number() const
{
  static const uint8_t numbers[] = {1, 2, 4, 8};
  return map_enum_number(numbers, 4, value, "sps_cfg_s::pdsch_aggregation_factor_r16_e_");
}

// SRS-TPC-CommandConfig ::= SEQUENCE
SRSASN_CODE srs_tpc_cmd_cfg_s::pack(bit_ref& bref) const
{
  bref.pack(ext, 1);
  HANDLE_CODE(bref.pack(start_bit_of_format2_3_present, 1));
  HANDLE_CODE(bref.pack(field_type_format2_3_present, 1));

  if (start_bit_of_format2_3_present) {
    HANDLE_CODE(pack_integer(bref, start_bit_of_format2_3, (uint8_t)1u, (uint8_t)31u));
  }
  if (field_type_format2_3_present) {
    HANDLE_CODE(pack_integer(bref, field_type_format2_3, (uint8_t)0u, (uint8_t)1u));
  }

  if (ext) {
    ext_groups_packer_guard group_flags;
    group_flags[0] |= start_bit_of_format2_3_sul_present;
    group_flags.pack(bref);

    if (group_flags[0]) {
      varlength_field_pack_guard varlen_scope(bref, false);

      HANDLE_CODE(bref.pack(start_bit_of_format2_3_sul_present, 1));
      if (start_bit_of_format2_3_sul_present) {
        HANDLE_CODE(pack_integer(bref, start_bit_of_format2_3_sul, (uint8_t)1u, (uint8_t)31u));
      }
    }
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE srs_tpc_cmd_cfg_s::unpack(cbit_ref& bref)
{
  bref.unpack(ext, 1);
  HANDLE_CODE(bref.unpack(start_bit_of_format2_3_present, 1));
  HANDLE_CODE(bref.unpack(field_type_format2_3_present, 1));

  if (start_bit_of_format2_3_present) {
    HANDLE_CODE(unpack_integer(start_bit_of_format2_3, bref, (uint8_t)1u, (uint8_t)31u));
  }
  if (field_type_format2_3_present) {
    HANDLE_CODE(unpack_integer(field_type_format2_3, bref, (uint8_t)0u, (uint8_t)1u));
  }

  if (ext) {
    ext_groups_unpacker_guard group_flags(1);
    group_flags.unpack(bref);

    if (group_flags[0]) {
      varlength_field_unpack_guard varlen_scope(bref, false);

      HANDLE_CODE(bref.unpack(start_bit_of_format2_3_sul_present, 1));
      if (start_bit_of_format2_3_sul_present) {
        HANDLE_CODE(unpack_integer(start_bit_of_format2_3_sul, bref, (uint8_t)1u, (uint8_t)31u));
      }
    }
  }
  return SRSASN_SUCCESS;
}
void srs_tpc_cmd_cfg_s::to_json(json_writer& j) const
{
  j.start_obj();
  if (start_bit_of_format2_3_present) {
    j.write_int("startingBitOfFormat2-3", start_bit_of_format2_3);
  }
  if (field_type_format2_3_present) {
    j.write_int("fieldTypeFormat2-3", field_type_format2_3);
  }
  if (ext) {
    if (start_bit_of_format2_3_sul_present) {
      j.write_int("startingBitOfFormat2-3SUL", start_bit_of_format2_3_sul);
    }
  }
  j.end_obj();
}

// SearchSpaceSwitchConfig-r16 ::= SEQUENCE
SRSASN_CODE search_space_switch_cfg_r16_s::pack(bit_ref& bref) const
{
  HANDLE_CODE(bref.pack(cell_groups_for_switch_list_r16.size() > 0, 1));
  HANDLE_CODE(bref.pack(search_space_switch_delay_r16_present, 1));

  if (cell_groups_for_switch_list_r16.size() > 0) {
    HANDLE_CODE(pack_dyn_seq_of(bref,
                                cell_groups_for_switch_list_r16,
                                1,
                                4,
                                SeqOfPacker<integer_packer<uint8_t>>(1, 16, integer_packer<uint8_t>(0, 31))));
  }
  if (search_space_switch_delay_r16_present) {
    HANDLE_CODE(pack_integer(bref, search_space_switch_delay_r16, (uint8_t)10u, (uint8_t)52u));
  }

  return SRSASN_SUCCESS;
}
SRSASN_CODE search_space_switch_cfg_r16_s::unpack(cbit_ref& bref)
{
  bool cell_groups_for_switch_list_r16_present;
  HANDLE_CODE(bref.unpack(cell_groups_for_switch_list_r16_present, 1));
  HANDLE_CODE(bref.unpack(search_space_switch_delay_r16_present, 1));

  if (cell_groups_for_switch_list_r16_present) {
    HANDLE_CODE(unpack_dyn_seq_of(cell_groups_for_switch_list_r16,
                                  bref,
                                  1,
                                  4,
                                  SeqOfPacker<integer_packer<uint8_t>>(1, 16, integer_packer<uint8_t>(0, 31))));
  }
  if (search_space_switch_delay_r16_present) {
    HANDLE_CODE(unpack_integer(search_space_switch_delay_r16, bref, (uint8_t)10u, (uint8_t)52u));
  }

  return SRSASN_SUCCESS;
}
void search_space_switch_cfg_r16_s::to_json(json_writer& j) const
{
  j.start_obj();
  if (cell_groups_for_switch_list_r16.size() > 0) {
    j.start_array("cellGroupsForSwitchList-r16");
    for (const auto& e1 : cell_groups_for_switch_list_r16) {
      j.start_array();
      for (const auto& e2 : e1) {
        j.write_int(e2);
      }
      j.end_array();
    }
    j.end_array();
  }
  if (search_space_switch_delay_r16_present) {
    j.write_int("searchSpaceSwitchDelay-r16", search_space_switch_delay_r16);
  }
  j.end_obj();
}

// SearchSpaceSwitchConfig-r17 ::= SEQUENCE
SRSASN_CODE search_space_switch_cfg_r17_s::pack(bit_ref& bref) const
{
  HANDLE_CODE(bref.pack(search_space_switch_timer_r17_present, 1));
  HANDLE_CODE(bref.pack(search_space_switch_delay_r17_present, 1));

  if (search_space_switch_timer_r17_present) {
    HANDLE_CODE(pack_integer(bref, search_space_switch_timer_r17, (uint8_t)1u, (uint8_t)166u));
  }
  if (search_space_switch_delay_r17_present) {
    HANDLE_CODE(pack_integer(bref, search_space_switch_delay_r17, (uint8_t)10u, (uint8_t)52u));
  }

  return SRSASN_SUCCESS;
}
SRSASN_CODE search_space_switch_cfg_r17_s::unpack(cbit_ref& bref)
{
  HANDLE_CODE(bref.unpack(search_space_switch_timer_r17_present, 1));
  HANDLE_CODE(bref.unpack(search_space_switch_delay_r17_present, 1));

  if (search_space_switch_timer_r17_present) {
    HANDLE_CODE(unpack_integer(search_space_switch_timer_r17, bref, (uint8_t)1u, (uint8_t)166u));
  }
  if (search_space_switch_delay_r17_present) {
    HANDLE_CODE(unpack_integer(search_space_switch_delay_r17, bref, (uint8_t)10u, (uint8_t)52u));
  }

  return SRSASN_SUCCESS;
}
void search_space_switch_cfg_r17_s::to_json(json_writer& j) const
{
  j.start_obj();
  if (search_space_switch_timer_r17_present) {
    j.write_int("searchSpaceSwitchTimer-r17", search_space_switch_timer_r17);
  }
  if (search_space_switch_delay_r17_present) {
    j.write_int("searchSpaceSwitchDelay-r17", search_space_switch_delay_r17);
  }
  j.end_obj();
}

// TCI-State ::= SEQUENCE
SRSASN_CODE tci_state_s::pack(bit_ref& bref) const
{
  bref.pack(ext, 1);
  HANDLE_CODE(bref.pack(qcl_type2_present, 1));

  HANDLE_CODE(pack_integer(bref, tci_state_id, (uint8_t)0u, (uint8_t)127u));
  HANDLE_CODE(qcl_type1.pack(bref));
  if (qcl_type2_present) {
    HANDLE_CODE(qcl_type2.pack(bref));
  }

  if (ext) {
    ext_groups_packer_guard group_flags;
    group_flags[0] |= add_pci_r17_present;
    group_flags[0] |= pathloss_ref_rs_id_r17_present;
    group_flags[0] |= ul_pwr_ctrl_r17_present;
    group_flags.pack(bref);

    if (group_flags[0]) {
      varlength_field_pack_guard varlen_scope(bref, false);

      HANDLE_CODE(bref.pack(add_pci_r17_present, 1));
      HANDLE_CODE(bref.pack(pathloss_ref_rs_id_r17_present, 1));
      HANDLE_CODE(bref.pack(ul_pwr_ctrl_r17_present, 1));
      if (add_pci_r17_present) {
        HANDLE_CODE(pack_integer(bref, add_pci_r17, (uint8_t)1u, (uint8_t)7u));
      }
      if (pathloss_ref_rs_id_r17_present) {
        HANDLE_CODE(pack_integer(bref, pathloss_ref_rs_id_r17, (uint8_t)0u, (uint8_t)63u));
      }
      if (ul_pwr_ctrl_r17_present) {
        HANDLE_CODE(pack_integer(bref, ul_pwr_ctrl_r17, (uint8_t)1u, (uint8_t)64u));
      }
    }
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE tci_state_s::unpack(cbit_ref& bref)
{
  bref.unpack(ext, 1);
  HANDLE_CODE(bref.unpack(qcl_type2_present, 1));

  HANDLE_CODE(unpack_integer(tci_state_id, bref, (uint8_t)0u, (uint8_t)127u));
  HANDLE_CODE(qcl_type1.unpack(bref));
  if (qcl_type2_present) {
    HANDLE_CODE(qcl_type2.unpack(bref));
  }

  if (ext) {
    ext_groups_unpacker_guard group_flags(1);
    group_flags.unpack(bref);

    if (group_flags[0]) {
      varlength_field_unpack_guard varlen_scope(bref, false);

      HANDLE_CODE(bref.unpack(add_pci_r17_present, 1));
      HANDLE_CODE(bref.unpack(pathloss_ref_rs_id_r17_present, 1));
      HANDLE_CODE(bref.unpack(ul_pwr_ctrl_r17_present, 1));
      if (add_pci_r17_present) {
        HANDLE_CODE(unpack_integer(add_pci_r17, bref, (uint8_t)1u, (uint8_t)7u));
      }
      if (pathloss_ref_rs_id_r17_present) {
        HANDLE_CODE(unpack_integer(pathloss_ref_rs_id_r17, bref, (uint8_t)0u, (uint8_t)63u));
      }
      if (ul_pwr_ctrl_r17_present) {
        HANDLE_CODE(unpack_integer(ul_pwr_ctrl_r17, bref, (uint8_t)1u, (uint8_t)64u));
      }
    }
  }
  return SRSASN_SUCCESS;
}
void tci_state_s::to_json(json_writer& j) const
{
  j.start_obj();
  j.write_int("tci-StateId", tci_state_id);
  j.write_fieldname("qcl-Type1");
  qcl_type1.to_json(j);
  if (qcl_type2_present) {
    j.write_fieldname("qcl-Type2");
    qcl_type2.to_json(j);
  }
  if (ext) {
    if (add_pci_r17_present) {
      j.write_int("additionalPCI-r17", add_pci_r17);
    }
    if (pathloss_ref_rs_id_r17_present) {
      j.write_int("pathlossReferenceRS-Id-r17", pathloss_ref_rs_id_r17);
    }
    if (ul_pwr_ctrl_r17_present) {
      j.write_int("ul-powerControl-r17", ul_pwr_ctrl_r17);
    }
  }
  j.end_obj();
}

// UplinkCancellation-r16 ::= SEQUENCE
SRSASN_CODE ul_cancellation_r16_s::pack(bit_ref& bref) const
{
  bref.pack(ext, 1);
  HANDLE_CODE(pack_integer(bref, ci_rnti_r16, (uint32_t)0u, (uint32_t)65535u));
  HANDLE_CODE(pack_integer(bref, dci_payload_size_for_ci_r16, (uint8_t)0u, (uint8_t)126u));
  HANDLE_CODE(pack_dyn_seq_of(bref, ci_cfg_per_serving_cell_r16, 1, 32));

  return SRSASN_SUCCESS;
}
SRSASN_CODE ul_cancellation_r16_s::unpack(cbit_ref& bref)
{
  bref.unpack(ext, 1);
  HANDLE_CODE(unpack_integer(ci_rnti_r16, bref, (uint32_t)0u, (uint32_t)65535u));
  HANDLE_CODE(unpack_integer(dci_payload_size_for_ci_r16, bref, (uint8_t)0u, (uint8_t)126u));
  HANDLE_CODE(unpack_dyn_seq_of(ci_cfg_per_serving_cell_r16, bref, 1, 32));

  return SRSASN_SUCCESS;
}
void ul_cancellation_r16_s::to_json(json_writer& j) const
{
  j.start_obj();
  j.write_int("ci-RNTI-r16", ci_rnti_r16);
  j.write_int("dci-PayloadSizeForCI-r16", dci_payload_size_for_ci_r16);
  j.start_array("ci-ConfigurationPerServingCell-r16");
  for (const auto& e1 : ci_cfg_per_serving_cell_r16) {
    e1.to_json(j);
  }
  j.end_array();
  j.end_obj();
}

// ZP-CSI-RS-Resource ::= SEQUENCE
SRSASN_CODE zp_csi_rs_res_s::pack(bit_ref& bref) const
{
  bref.pack(ext, 1);
  HANDLE_CODE(bref.pack(periodicity_and_offset_present, 1));

  HANDLE_CODE(pack_integer(bref, zp_csi_rs_res_id, (uint8_t)0u, (uint8_t)31u));
  HANDLE_CODE(res_map.pack(bref));
  if (periodicity_and_offset_present) {
    HANDLE_CODE(periodicity_and_offset.pack(bref));
  }

  return SRSASN_SUCCESS;
}
SRSASN_CODE zp_csi_rs_res_s::unpack(cbit_ref& bref)
{
  bref.unpack(ext, 1);
  HANDLE_CODE(bref.unpack(periodicity_and_offset_present, 1));

  HANDLE_CODE(unpack_integer(zp_csi_rs_res_id, bref, (uint8_t)0u, (uint8_t)31u));
  HANDLE_CODE(res_map.unpack(bref));
  if (periodicity_and_offset_present) {
    HANDLE_CODE(periodicity_and_offset.unpack(bref));
  }

  return SRSASN_SUCCESS;
}
void zp_csi_rs_res_s::to_json(json_writer& j) const
{
  j.start_obj();
  j.write_int("zp-CSI-RS-ResourceId", zp_csi_rs_res_id);
  j.write_fieldname("resourceMapping");
  res_map.to_json(j);
  if (periodicity_and_offset_present) {
    j.write_fieldname("periodicityAndOffset");
    periodicity_and_offset.to_json(j);
  }
  j.end_obj();
}

// ZP-CSI-RS-ResourceSet ::= SEQUENCE
SRSASN_CODE zp_csi_rs_res_set_s::pack(bit_ref& bref) const
{
  bref.pack(ext, 1);
  HANDLE_CODE(pack_integer(bref, zp_csi_rs_res_set_id, (uint8_t)0u, (uint8_t)15u));
  HANDLE_CODE(pack_dyn_seq_of(bref, zp_csi_rs_res_id_list, 1, 16, integer_packer<uint8_t>(0, 31)));

  return SRSASN_SUCCESS;
}
SRSASN_CODE zp_csi_rs_res_set_s::unpack(cbit_ref& bref)
{
  bref.unpack(ext, 1);
  HANDLE_CODE(unpack_integer(zp_csi_rs_res_set_id, bref, (uint8_t)0u, (uint8_t)15u));
  HANDLE_CODE(unpack_dyn_seq_of(zp_csi_rs_res_id_list, bref, 1, 16, integer_packer<uint8_t>(0, 31)));

  return SRSASN_SUCCESS;
}
void zp_csi_rs_res_set_s::to_json(json_writer& j) const
{
  j.start_obj();
  j.write_int("zp-CSI-RS-ResourceSetId", zp_csi_rs_res_set_id);
  j.start_array("zp-CSI-RS-ResourceIdList");
  for (const auto& e1 : zp_csi_rs_res_id_list) {
    j.write_int(e1);
  }
  j.end_array();
  j.end_obj();
}

// BeamFailureDetection-r17 ::= SEQUENCE
SRSASN_CODE beam_fail_detection_r17_s::pack(bit_ref& bref) const
{
  HANDLE_CODE(bref.pack(fail_detection_set1_r17_present, 1));
  HANDLE_CODE(bref.pack(fail_detection_set2_r17_present, 1));
  HANDLE_CODE(bref.pack(add_pci_r17_present, 1));

  if (fail_detection_set1_r17_present) {
    HANDLE_CODE(fail_detection_set1_r17.pack(bref));
  }
  if (fail_detection_set2_r17_present) {
    HANDLE_CODE(fail_detection_set2_r17.pack(bref));
  }
  if (add_pci_r17_present) {
    HANDLE_CODE(pack_integer(bref, add_pci_r17, (uint8_t)1u, (uint8_t)7u));
  }

  return SRSASN_SUCCESS;
}
SRSASN_CODE beam_fail_detection_r17_s::unpack(cbit_ref& bref)
{
  HANDLE_CODE(bref.unpack(fail_detection_set1_r17_present, 1));
  HANDLE_CODE(bref.unpack(fail_detection_set2_r17_present, 1));
  HANDLE_CODE(bref.unpack(add_pci_r17_present, 1));

  if (fail_detection_set1_r17_present) {
    HANDLE_CODE(fail_detection_set1_r17.unpack(bref));
  }
  if (fail_detection_set2_r17_present) {
    HANDLE_CODE(fail_detection_set2_r17.unpack(bref));
  }
  if (add_pci_r17_present) {
    HANDLE_CODE(unpack_integer(add_pci_r17, bref, (uint8_t)1u, (uint8_t)7u));
  }

  return SRSASN_SUCCESS;
}
void beam_fail_detection_r17_s::to_json(json_writer& j) const
{
  j.start_obj();
  if (fail_detection_set1_r17_present) {
    j.write_fieldname("failureDetectionSet1-r17");
    fail_detection_set1_r17.to_json(j);
  }
  if (fail_detection_set2_r17_present) {
    j.write_fieldname("failureDetectionSet2-r17");
    fail_detection_set2_r17.to_json(j);
  }
  if (add_pci_r17_present) {
    j.write_int("additionalPCI-r17", add_pci_r17);
  }
  j.end_obj();
}

// CandidateBeamRS-r16 ::= SEQUENCE
SRSASN_CODE candidate_beam_rs_r16_s::pack(bit_ref& bref) const
{
  HANDLE_CODE(bref.pack(serving_cell_id_present, 1));

  HANDLE_CODE(candidate_beam_cfg_r16.pack(bref));
  if (serving_cell_id_present) {
    HANDLE_CODE(pack_integer(bref, serving_cell_id, (uint8_t)0u, (uint8_t)31u));
  }

  return SRSASN_SUCCESS;
}
SRSASN_CODE candidate_beam_rs_r16_s::unpack(cbit_ref& bref)
{
  HANDLE_CODE(bref.unpack(serving_cell_id_present, 1));

  HANDLE_CODE(candidate_beam_cfg_r16.unpack(bref));
  if (serving_cell_id_present) {
    HANDLE_CODE(unpack_integer(serving_cell_id, bref, (uint8_t)0u, (uint8_t)31u));
  }

  return SRSASN_SUCCESS;
}
void candidate_beam_rs_r16_s::to_json(json_writer& j) const
{
  j.start_obj();
  j.write_fieldname("candidateBeamConfig-r16");
  candidate_beam_cfg_r16.to_json(j);
  if (serving_cell_id_present) {
    j.write_int("servingCellId", serving_cell_id);
  }
  j.end_obj();
}

void candidate_beam_rs_r16_s::candidate_beam_cfg_r16_c_::destroy_() {}
void candidate_beam_rs_r16_s::candidate_beam_cfg_r16_c_::set(types::options e)
{
  destroy_();
  type_ = e;
}
candidate_beam_rs_r16_s::candidate_beam_cfg_r16_c_::candidate_beam_cfg_r16_c_(
    const candidate_beam_rs_r16_s::candidate_beam_cfg_r16_c_& other)
{
  type_ = other.type();
  switch (type_) {
    case types::ssb_r16:
      c.init(other.c.get<uint8_t>());
      break;
    case types::csi_rs_r16:
      c.init(other.c.get<uint8_t>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "candidate_beam_rs_r16_s::candidate_beam_cfg_r16_c_");
  }
}
candidate_beam_rs_r16_s::candidate_beam_cfg_r16_c_& candidate_beam_rs_r16_s::candidate_beam_cfg_r16_c_::operator=(
    const candidate_beam_rs_r16_s::candidate_beam_cfg_r16_c_& other)
{
  if (this == &other) {
    return *this;
  }
  set(other.type());
  switch (type_) {
    case types::ssb_r16:
      c.set(other.c.get<uint8_t>());
      break;
    case types::csi_rs_r16:
      c.set(other.c.get<uint8_t>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "candidate_beam_rs_r16_s::candidate_beam_cfg_r16_c_");
  }

  return *this;
}
uint8_t& candidate_beam_rs_r16_s::candidate_beam_cfg_r16_c_::set_ssb_r16()
{
  set(types::ssb_r16);
  return c.get<uint8_t>();
}
uint8_t& candidate_beam_rs_r16_s::candidate_beam_cfg_r16_c_::set_csi_rs_r16()
{
  set(types::csi_rs_r16);
  return c.get<uint8_t>();
}
void candidate_beam_rs_r16_s::candidate_beam_cfg_r16_c_::to_json(json_writer& j) const
{
  j.start_obj();
  switch (type_) {
    case types::ssb_r16:
      j.write_int("ssb-r16", c.get<uint8_t>());
      break;
    case types::csi_rs_r16:
      j.write_int("csi-RS-r16", c.get<uint8_t>());
      break;
    default:
      log_invalid_choice_id(type_, "candidate_beam_rs_r16_s::candidate_beam_cfg_r16_c_");
  }
  j.end_obj();
}
SRSASN_CODE candidate_beam_rs_r16_s::candidate_beam_cfg_r16_c_::pack(bit_ref& bref) const
{
  type_.pack(bref);
  switch (type_) {
    case types::ssb_r16:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)63u));
      break;
    case types::csi_rs_r16:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)191u));
      break;
    default:
      log_invalid_choice_id(type_, "candidate_beam_rs_r16_s::candidate_beam_cfg_r16_c_");
      return SRSASN_ERROR_ENCODE_FAIL;
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE candidate_beam_rs_r16_s::candidate_beam_cfg_r16_c_::unpack(cbit_ref& bref)
{
  types e;
  e.unpack(bref);
  set(e);
  switch (type_) {
    case types::ssb_r16:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)63u));
      break;
    case types::csi_rs_r16:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)191u));
      break;
    default:
      log_invalid_choice_id(type_, "candidate_beam_rs_r16_s::candidate_beam_cfg_r16_c_");
      return SRSASN_ERROR_DECODE_FAIL;
  }
  return SRSASN_SUCCESS;
}

const char* candidate_beam_rs_r16_s::candidate_beam_cfg_r16_c_::types_opts::to_string() const
{
  static const char* names[] = {"ssb-r16", "csi-RS-r16"};
  return convert_enum_idx(names, 2, value, "candidate_beam_rs_r16_s::candidate_beam_cfg_r16_c_::types");
}

// DL-PPW-PreConfig-r17 ::= SEQUENCE
SRSASN_CODE dl_ppw_pre_cfg_r17_s::pack(bit_ref& bref) const
{
  HANDLE_CODE(bref.pack(type_r17_present, 1));
  HANDLE_CODE(bref.pack(prio_r17_present, 1));

  HANDLE_CODE(pack_integer(bref, dl_ppw_id_r17, (uint8_t)0u, (uint8_t)15u));
  HANDLE_CODE(dl_ppw_periodicity_and_start_slot_r17.pack(bref));
  HANDLE_CODE(pack_integer(bref, len_r17, (uint8_t)1u, (uint8_t)160u));
  if (type_r17_present) {
    HANDLE_CODE(type_r17.pack(bref));
  }
  if (prio_r17_present) {
    HANDLE_CODE(prio_r17.pack(bref));
  }

  return SRSASN_SUCCESS;
}
SRSASN_CODE dl_ppw_pre_cfg_r17_s::unpack(cbit_ref& bref)
{
  HANDLE_CODE(bref.unpack(type_r17_present, 1));
  HANDLE_CODE(bref.unpack(prio_r17_present, 1));

  HANDLE_CODE(unpack_integer(dl_ppw_id_r17, bref, (uint8_t)0u, (uint8_t)15u));
  HANDLE_CODE(dl_ppw_periodicity_and_start_slot_r17.unpack(bref));
  HANDLE_CODE(unpack_integer(len_r17, bref, (uint8_t)1u, (uint8_t)160u));
  if (type_r17_present) {
    HANDLE_CODE(type_r17.unpack(bref));
  }
  if (prio_r17_present) {
    HANDLE_CODE(prio_r17.unpack(bref));
  }

  return SRSASN_SUCCESS;
}
void dl_ppw_pre_cfg_r17_s::to_json(json_writer& j) const
{
  j.start_obj();
  j.write_int("dl-PPW-ID-r17", dl_ppw_id_r17);
  j.write_fieldname("dl-PPW-PeriodicityAndStartSlot-r17");
  dl_ppw_periodicity_and_start_slot_r17.to_json(j);
  j.write_int("length-r17", len_r17);
  if (type_r17_present) {
    j.write_str("type-r17", type_r17.to_string());
  }
  if (prio_r17_present) {
    j.write_str("priority-r17", prio_r17.to_string());
  }
  j.end_obj();
}

const char* dl_ppw_pre_cfg_r17_s::type_r17_opts::to_string() const
{
  static const char* names[] = {"type1A", "type1B", "type2"};
  return convert_enum_idx(names, 3, value, "dl_ppw_pre_cfg_r17_s::type_r17_e_");
}

const char* dl_ppw_pre_cfg_r17_s::prio_r17_opts::to_string() const
{
  static const char* names[] = {"st1", "st2", "st3"};
  return convert_enum_idx(names, 3, value, "dl_ppw_pre_cfg_r17_s::prio_r17_e_");
}
uint8_t dl_ppw_pre_cfg_r17_s::prio_r17_opts::to_number() const
{
  static const uint8_t numbers[] = {1, 2, 3};
  return map_enum_number(numbers, 3, value, "dl_ppw_pre_cfg_r17_s::prio_r17_e_");
}

// PDCCH-Config ::= SEQUENCE
SRSASN_CODE pdcch_cfg_s::pack(bit_ref& bref) const
{
  bref.pack(ext, 1);
  HANDLE_CODE(bref.pack(coreset_to_add_mod_list.size() > 0, 1));
  HANDLE_CODE(bref.pack(coreset_to_release_list.size() > 0, 1));
  HANDLE_CODE(bref.pack(search_spaces_to_add_mod_list.size() > 0, 1));
  HANDLE_CODE(bref.pack(search_spaces_to_release_list.size() > 0, 1));
  HANDLE_CODE(bref.pack(dl_preemption_present, 1));
  HANDLE_CODE(bref.pack(tpc_pusch_present, 1));
  HANDLE_CODE(bref.pack(tpc_pucch_present, 1));
  HANDLE_CODE(bref.pack(tpc_srs_present, 1));

  if (coreset_to_add_mod_list.size() > 0) {
    HANDLE_CODE(pack_dyn_seq_of(bref, coreset_to_add_mod_list, 1, 3));
  }
  if (coreset_to_release_list.size() > 0) {
    HANDLE_CODE(pack_dyn_seq_of(bref, coreset_to_release_list, 1, 3, integer_packer<uint8_t>(0, 11)));
  }
  if (search_spaces_to_add_mod_list.size() > 0) {
    HANDLE_CODE(pack_dyn_seq_of(bref, search_spaces_to_add_mod_list, 1, 10));
  }
  if (search_spaces_to_release_list.size() > 0) {
    HANDLE_CODE(pack_dyn_seq_of(bref, search_spaces_to_release_list, 1, 10, integer_packer<uint8_t>(0, 39)));
  }
  if (dl_preemption_present) {
    HANDLE_CODE(dl_preemption.pack(bref));
  }
  if (tpc_pusch_present) {
    HANDLE_CODE(tpc_pusch.pack(bref));
  }
  if (tpc_pucch_present) {
    HANDLE_CODE(tpc_pucch.pack(bref));
  }
  if (tpc_srs_present) {
    HANDLE_CODE(tpc_srs.pack(bref));
  }

  if (ext) {
    ext_groups_packer_guard group_flags;
    group_flags[0] |= coreset_to_add_mod_list_size_ext_v1610.is_present();
    group_flags[0] |= coreset_to_release_list_size_ext_r16.is_present();
    group_flags[0] |= search_spaces_to_add_mod_list_ext_r16.is_present();
    group_flags[0] |= ul_cancellation_r16.is_present();
    group_flags[0] |= monitoring_cap_cfg_r16_present;
    group_flags[0] |= search_space_switch_cfg_r16.is_present();
    group_flags[1] |= search_spaces_to_add_mod_list_ext_v1700.is_present();
    group_flags[1] |= monitoring_cap_cfg_v1710_present;
    group_flags[1] |= search_space_switch_cfg_r17.is_present();
    group_flags[1] |= pdcch_skipping_dur_list_r17.is_present();
    group_flags.pack(bref);

    if (group_flags[0]) {
      varlength_field_pack_guard varlen_scope(bref, false);

      HANDLE_CODE(bref.pack(coreset_to_add_mod_list_size_ext_v1610.is_present(), 1));
      HANDLE_CODE(bref.pack(coreset_to_release_list_size_ext_r16.is_present(), 1));
      HANDLE_CODE(bref.pack(search_spaces_to_add_mod_list_ext_r16.is_present(), 1));
      HANDLE_CODE(bref.pack(ul_cancellation_r16.is_present(), 1));
      HANDLE_CODE(bref.pack(monitoring_cap_cfg_r16_present, 1));
      HANDLE_CODE(bref.pack(search_space_switch_cfg_r16.is_present(), 1));
      if (coreset_to_add_mod_list_size_ext_v1610.is_present()) {
        HANDLE_CODE(pack_dyn_seq_of(bref, *coreset_to_add_mod_list_size_ext_v1610, 1, 2));
      }
      if (coreset_to_release_list_size_ext_r16.is_present()) {
        HANDLE_CODE(pack_dyn_seq_of(bref, *coreset_to_release_list_size_ext_r16, 1, 5, integer_packer<uint8_t>(0, 15)));
      }
      if (search_spaces_to_add_mod_list_ext_r16.is_present()) {
        HANDLE_CODE(pack_dyn_seq_of(bref, *search_spaces_to_add_mod_list_ext_r16, 1, 10));
      }
      if (ul_cancellation_r16.is_present()) {
        HANDLE_CODE(ul_cancellation_r16->pack(bref));
      }
      if (monitoring_cap_cfg_r16_present) {
        HANDLE_CODE(monitoring_cap_cfg_r16.pack(bref));
      }
      if (search_space_switch_cfg_r16.is_present()) {
        HANDLE_CODE(search_space_switch_cfg_r16->pack(bref));
      }
    }
    if (group_flags[1]) {
      varlength_field_pack_guard varlen_scope(bref, false);

      HANDLE_CODE(bref.pack(search_spaces_to_add_mod_list_ext_v1700.is_present(), 1));
      HANDLE_CODE(bref.pack(monitoring_cap_cfg_v1710_present, 1));
      HANDLE_CODE(bref.pack(search_space_switch_cfg_r17.is_present(), 1));
      HANDLE_CODE(bref.pack(pdcch_skipping_dur_list_r17.is_present(), 1));
      if (search_spaces_to_add_mod_list_ext_v1700.is_present()) {
        HANDLE_CODE(pack_dyn_seq_of(bref, *search_spaces_to_add_mod_list_ext_v1700, 1, 10));
      }
      if (search_space_switch_cfg_r17.is_present()) {
        HANDLE_CODE(search_space_switch_cfg_r17->pack(bref));
      }
      if (pdcch_skipping_dur_list_r17.is_present()) {
        HANDLE_CODE(pack_dyn_seq_of(bref, *pdcch_skipping_dur_list_r17, 1, 3, integer_packer<uint8_t>(1, 166)));
      }
    }
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE pdcch_cfg_s::unpack(cbit_ref& bref)
{
  bref.unpack(ext, 1);
  bool coreset_to_add_mod_list_present;
  HANDLE_CODE(bref.unpack(coreset_to_add_mod_list_present, 1));
  bool coreset_to_release_list_present;
  HANDLE_CODE(bref.unpack(coreset_to_release_list_present, 1));
  bool search_spaces_to_add_mod_list_present;
  HANDLE_CODE(bref.unpack(search_spaces_to_add_mod_list_present, 1));
  bool search_spaces_to_release_list_present;
  HANDLE_CODE(bref.unpack(search_spaces_to_release_list_present, 1));
  HANDLE_CODE(bref.unpack(dl_preemption_present, 1));
  HANDLE_CODE(bref.unpack(tpc_pusch_present, 1));
  HANDLE_CODE(bref.unpack(tpc_pucch_present, 1));
  HANDLE_CODE(bref.unpack(tpc_srs_present, 1));

  if (coreset_to_add_mod_list_present) {
    HANDLE_CODE(unpack_dyn_seq_of(coreset_to_add_mod_list, bref, 1, 3));
  }
  if (coreset_to_release_list_present) {
    HANDLE_CODE(unpack_dyn_seq_of(coreset_to_release_list, bref, 1, 3, integer_packer<uint8_t>(0, 11)));
  }
  if (search_spaces_to_add_mod_list_present) {
    HANDLE_CODE(unpack_dyn_seq_of(search_spaces_to_add_mod_list, bref, 1, 10));
  }
  if (search_spaces_to_release_list_present) {
    HANDLE_CODE(unpack_dyn_seq_of(search_spaces_to_release_list, bref, 1, 10, integer_packer<uint8_t>(0, 39)));
  }
  if (dl_preemption_present) {
    HANDLE_CODE(dl_preemption.unpack(bref));
  }
  if (tpc_pusch_present) {
    HANDLE_CODE(tpc_pusch.unpack(bref));
  }
  if (tpc_pucch_present) {
    HANDLE_CODE(tpc_pucch.unpack(bref));
  }
  if (tpc_srs_present) {
    HANDLE_CODE(tpc_srs.unpack(bref));
  }

  if (ext) {
    ext_groups_unpacker_guard group_flags(2);
    group_flags.unpack(bref);

    if (group_flags[0]) {
      varlength_field_unpack_guard varlen_scope(bref, false);

      unpack_presence_flag(coreset_to_add_mod_list_size_ext_v1610, bref);
      unpack_presence_flag(coreset_to_release_list_size_ext_r16, bref);
      unpack_presence_flag(search_spaces_to_add_mod_list_ext_r16, bref);
      unpack_presence_flag(ul_cancellation_r16, bref);
      HANDLE_CODE(bref.unpack(monitoring_cap_cfg_r16_present, 1));
      unpack_presence_flag(search_space_switch_cfg_r16, bref);
      if (coreset_to_add_mod_list_size_ext_v1610.is_present()) {
        HANDLE_CODE(unpack_dyn_seq_of(*coreset_to_add_mod_list_size_ext_v1610, bref, 1, 2));
      }
      if (coreset_to_release_list_size_ext_r16.is_present()) {
        HANDLE_CODE(
            unpack_dyn_seq_of(*coreset_to_release_list_size_ext_r16, bref, 1, 5, integer_packer<uint8_t>(0, 15)));
      }
      if (search_spaces_to_add_mod_list_ext_r16.is_present()) {
        HANDLE_CODE(unpack_dyn_seq_of(*search_spaces_to_add_mod_list_ext_r16, bref, 1, 10));
      }
      if (ul_cancellation_r16.is_present()) {
        HANDLE_CODE(ul_cancellation_r16->unpack(bref));
      }
      if (monitoring_cap_cfg_r16_present) {
        HANDLE_CODE(monitoring_cap_cfg_r16.unpack(bref));
      }
      if (search_space_switch_cfg_r16.is_present()) {
        HANDLE_CODE(search_space_switch_cfg_r16->unpack(bref));
      }
    }
    if (group_flags[1]) {
      varlength_field_unpack_guard varlen_scope(bref, false);

      unpack_presence_flag(search_spaces_to_add_mod_list_ext_v1700, bref);
      HANDLE_CODE(bref.unpack(monitoring_cap_cfg_v1710_present, 1));
      unpack_presence_flag(search_space_switch_cfg_r17, bref);
      unpack_presence_flag(pdcch_skipping_dur_list_r17, bref);
      if (search_spaces_to_add_mod_list_ext_v1700.is_present()) {
        HANDLE_CODE(unpack_dyn_seq_of(*search_spaces_to_add_mod_list_ext_v1700, bref, 1, 10));
      }
      if (search_space_switch_cfg_r17.is_present()) {
        HANDLE_CODE(search_space_switch_cfg_r17->unpack(bref));
      }
      if (pdcch_skipping_dur_list_r17.is_present()) {
        HANDLE_CODE(unpack_dyn_seq_of(*pdcch_skipping_dur_list_r17, bref, 1, 3, integer_packer<uint8_t>(1, 166)));
      }
    }
  }
  return SRSASN_SUCCESS;
}
void pdcch_cfg_s::to_json(json_writer& j) const
{
  j.start_obj();
  if (coreset_to_add_mod_list.size() > 0) {
    j.start_array("controlResourceSetToAddModList");
    for (const auto& e1 : coreset_to_add_mod_list) {
      e1.to_json(j);
    }
    j.end_array();
  }
  if (coreset_to_release_list.size() > 0) {
    j.start_array("controlResourceSetToReleaseList");
    for (const auto& e1 : coreset_to_release_list) {
      j.write_int(e1);
    }
    j.end_array();
  }
  if (search_spaces_to_add_mod_list.size() > 0) {
    j.start_array("searchSpacesToAddModList");
    for (const auto& e1 : search_spaces_to_add_mod_list) {
      e1.to_json(j);
    }
    j.end_array();
  }
  if (search_spaces_to_release_list.size() > 0) {
    j.start_array("searchSpacesToReleaseList");
    for (const auto& e1 : search_spaces_to_release_list) {
      j.write_int(e1);
    }
    j.end_array();
  }
  if (dl_preemption_present) {
    j.write_fieldname("downlinkPreemption");
    dl_preemption.to_json(j);
  }
  if (tpc_pusch_present) {
    j.write_fieldname("tpc-PUSCH");
    tpc_pusch.to_json(j);
  }
  if (tpc_pucch_present) {
    j.write_fieldname("tpc-PUCCH");
    tpc_pucch.to_json(j);
  }
  if (tpc_srs_present) {
    j.write_fieldname("tpc-SRS");
    tpc_srs.to_json(j);
  }
  if (ext) {
    if (coreset_to_add_mod_list_size_ext_v1610.is_present()) {
      j.start_array("controlResourceSetToAddModListSizeExt-v1610");
      for (const auto& e1 : *coreset_to_add_mod_list_size_ext_v1610) {
        e1.to_json(j);
      }
      j.end_array();
    }
    if (coreset_to_release_list_size_ext_r16.is_present()) {
      j.start_array("controlResourceSetToReleaseListSizeExt-r16");
      for (const auto& e1 : *coreset_to_release_list_size_ext_r16) {
        j.write_int(e1);
      }
      j.end_array();
    }
    if (search_spaces_to_add_mod_list_ext_r16.is_present()) {
      j.start_array("searchSpacesToAddModListExt-r16");
      for (const auto& e1 : *search_spaces_to_add_mod_list_ext_r16) {
        e1.to_json(j);
      }
      j.end_array();
    }
    if (ul_cancellation_r16.is_present()) {
      j.write_fieldname("uplinkCancellation-r16");
      ul_cancellation_r16->to_json(j);
    }
    if (monitoring_cap_cfg_r16_present) {
      j.write_str("monitoringCapabilityConfig-r16", monitoring_cap_cfg_r16.to_string());
    }
    if (search_space_switch_cfg_r16.is_present()) {
      j.write_fieldname("searchSpaceSwitchConfig-r16");
      search_space_switch_cfg_r16->to_json(j);
    }
    if (search_spaces_to_add_mod_list_ext_v1700.is_present()) {
      j.start_array("searchSpacesToAddModListExt-v1700");
      for (const auto& e1 : *search_spaces_to_add_mod_list_ext_v1700) {
        e1.to_json(j);
      }
      j.end_array();
    }
    if (monitoring_cap_cfg_v1710_present) {
      j.write_str("monitoringCapabilityConfig-v1710", "r17monitoringcapability");
    }
    if (search_space_switch_cfg_r17.is_present()) {
      j.write_fieldname("searchSpaceSwitchConfig-r17");
      search_space_switch_cfg_r17->to_json(j);
    }
    if (pdcch_skipping_dur_list_r17.is_present()) {
      j.start_array("pdcch-SkippingDurationList-r17");
      for (const auto& e1 : *pdcch_skipping_dur_list_r17) {
        j.write_int(e1);
      }
      j.end_array();
    }
  }
  j.end_obj();
}

const char* pdcch_cfg_s::monitoring_cap_cfg_r16_opts::to_string() const
{
  static const char* names[] = {"r15monitoringcapability", "r16monitoringcapability"};
  return convert_enum_idx(names, 2, value, "pdcch_cfg_s::monitoring_cap_cfg_r16_e_");
}
uint8_t pdcch_cfg_s::monitoring_cap_cfg_r16_opts::to_number() const
{
  static const uint8_t numbers[] = {15, 16};
  return map_enum_number(numbers, 2, value, "pdcch_cfg_s::monitoring_cap_cfg_r16_e_");
}

// PDSCH-Config ::= SEQUENCE
SRSASN_CODE pdsch_cfg_s::pack(bit_ref& bref) const
{
  bref.pack(ext, 1);
  HANDLE_CODE(bref.pack(data_scrambling_id_pdsch_present, 1));
  HANDLE_CODE(bref.pack(dmrs_dl_for_pdsch_map_type_a_present, 1));
  HANDLE_CODE(bref.pack(dmrs_dl_for_pdsch_map_type_b_present, 1));
  HANDLE_CODE(bref.pack(tci_states_to_add_mod_list.size() > 0, 1));
  HANDLE_CODE(bref.pack(tci_states_to_release_list.size() > 0, 1));
  HANDLE_CODE(bref.pack(vrb_to_prb_interleaver_present, 1));
  HANDLE_CODE(bref.pack(pdsch_time_domain_alloc_list_present, 1));
  HANDLE_CODE(bref.pack(pdsch_aggregation_factor_present, 1));
  HANDLE_CODE(bref.pack(rate_match_pattern_to_add_mod_list.size() > 0, 1));
  HANDLE_CODE(bref.pack(rate_match_pattern_to_release_list.size() > 0, 1));
  HANDLE_CODE(bref.pack(rate_match_pattern_group1.size() > 0, 1));
  HANDLE_CODE(bref.pack(rate_match_pattern_group2.size() > 0, 1));
  HANDLE_CODE(bref.pack(mcs_table_present, 1));
  HANDLE_CODE(bref.pack(max_nrof_code_words_sched_by_dci_present, 1));
  HANDLE_CODE(bref.pack(zp_csi_rs_res_to_add_mod_list.size() > 0, 1));
  HANDLE_CODE(bref.pack(zp_csi_rs_res_to_release_list.size() > 0, 1));
  HANDLE_CODE(bref.pack(aperiodic_zp_csi_rs_res_sets_to_add_mod_list.size() > 0, 1));
  HANDLE_CODE(bref.pack(aperiodic_zp_csi_rs_res_sets_to_release_list.size() > 0, 1));
  HANDLE_CODE(bref.pack(sp_zp_csi_rs_res_sets_to_add_mod_list.size() > 0, 1));
  HANDLE_CODE(bref.pack(sp_zp_csi_rs_res_sets_to_release_list.size() > 0, 1));
  HANDLE_CODE(bref.pack(p_zp_csi_rs_res_set_present, 1));

  if (data_scrambling_id_pdsch_present) {
    HANDLE_CODE(pack_integer(bref, data_scrambling_id_pdsch, (uint16_t)0u, (uint16_t)1023u));
  }
  if (dmrs_dl_for_pdsch_map_type_a_present) {
    HANDLE_CODE(dmrs_dl_for_pdsch_map_type_a.pack(bref));
  }
  if (dmrs_dl_for_pdsch_map_type_b_present) {
    HANDLE_CODE(dmrs_dl_for_pdsch_map_type_b.pack(bref));
  }
  if (tci_states_to_add_mod_list.size() > 0) {
    HANDLE_CODE(pack_dyn_seq_of(bref, tci_states_to_add_mod_list, 1, 128));
  }
  if (tci_states_to_release_list.size() > 0) {
    HANDLE_CODE(pack_dyn_seq_of(bref, tci_states_to_release_list, 1, 128, integer_packer<uint8_t>(0, 127)));
  }
  if (vrb_to_prb_interleaver_present) {
    HANDLE_CODE(vrb_to_prb_interleaver.pack(bref));
  }
  HANDLE_CODE(res_alloc.pack(bref));
  if (pdsch_time_domain_alloc_list_present) {
    HANDLE_CODE(pdsch_time_domain_alloc_list.pack(bref));
  }
  if (pdsch_aggregation_factor_present) {
    HANDLE_CODE(pdsch_aggregation_factor.pack(bref));
  }
  if (rate_match_pattern_to_add_mod_list.size() > 0) {
    HANDLE_CODE(pack_dyn_seq_of(bref, rate_match_pattern_to_add_mod_list, 1, 4));
  }
  if (rate_match_pattern_to_release_list.size() > 0) {
    HANDLE_CODE(pack_dyn_seq_of(bref, rate_match_pattern_to_release_list, 1, 4, integer_packer<uint8_t>(0, 3)));
  }
  if (rate_match_pattern_group1.size() > 0) {
    HANDLE_CODE(pack_dyn_seq_of(bref, rate_match_pattern_group1, 1, 8));
  }
  if (rate_match_pattern_group2.size() > 0) {
    HANDLE_CODE(pack_dyn_seq_of(bref, rate_match_pattern_group2, 1, 8));
  }
  HANDLE_CODE(rbg_size.pack(bref));
  if (mcs_table_present) {
    HANDLE_CODE(mcs_table.pack(bref));
  }
  if (max_nrof_code_words_sched_by_dci_present) {
    HANDLE_CODE(max_nrof_code_words_sched_by_dci.pack(bref));
  }
  HANDLE_CODE(prb_bundling_type.pack(bref));
  if (zp_csi_rs_res_to_add_mod_list.size() > 0) {
    HANDLE_CODE(pack_dyn_seq_of(bref, zp_csi_rs_res_to_add_mod_list, 1, 32));
  }
  if (zp_csi_rs_res_to_release_list.size() > 0) {
    HANDLE_CODE(pack_dyn_seq_of(bref, zp_csi_rs_res_to_release_list, 1, 32, integer_packer<uint8_t>(0, 31)));
  }
  if (aperiodic_zp_csi_rs_res_sets_to_add_mod_list.size() > 0) {
    HANDLE_CODE(pack_dyn_seq_of(bref, aperiodic_zp_csi_rs_res_sets_to_add_mod_list, 1, 16));
  }
  if (aperiodic_zp_csi_rs_res_sets_to_release_list.size() > 0) {
    HANDLE_CODE(
        pack_dyn_seq_of(bref, aperiodic_zp_csi_rs_res_sets_to_release_list, 1, 16, integer_packer<uint8_t>(0, 15)));
  }
  if (sp_zp_csi_rs_res_sets_to_add_mod_list.size() > 0) {
    HANDLE_CODE(pack_dyn_seq_of(bref, sp_zp_csi_rs_res_sets_to_add_mod_list, 1, 16));
  }
  if (sp_zp_csi_rs_res_sets_to_release_list.size() > 0) {
    HANDLE_CODE(pack_dyn_seq_of(bref, sp_zp_csi_rs_res_sets_to_release_list, 1, 16, integer_packer<uint8_t>(0, 15)));
  }
  if (p_zp_csi_rs_res_set_present) {
    HANDLE_CODE(p_zp_csi_rs_res_set.pack(bref));
  }

  if (ext) {
    ext_groups_packer_guard group_flags;
    group_flags[0] |= max_mimo_layers_r16.is_present();
    group_flags[0] |= minimum_sched_offset_k0_r16.is_present();
    group_flags[0] |= ant_ports_field_presence_dci_1_2_r16_present;
    group_flags[0] |= aperiodic_zp_csi_rs_res_sets_to_add_mod_list_dci_1_2_r16.is_present();
    group_flags[0] |= aperiodic_zp_csi_rs_res_sets_to_release_list_dci_1_2_r16.is_present();
    group_flags[0] |= dmrs_dl_for_pdsch_map_type_a_dci_1_2_r16.is_present();
    group_flags[0] |= dmrs_dl_for_pdsch_map_type_b_dci_1_2_r16.is_present();
    group_flags[0] |= dmrs_seq_initization_dci_1_2_r16_present;
    group_flags[0] |= harq_process_num_size_dci_1_2_r16_present;
    group_flags[0] |= mcs_table_dci_1_2_r16_present;
    group_flags[0] |= nof_bits_for_rv_dci_1_2_r16_present;
    group_flags[0] |= pdsch_time_domain_alloc_list_dci_1_2_r16.is_present();
    group_flags[0] |= prb_bundling_type_dci_1_2_r16.is_present();
    group_flags[0] |= prio_ind_dci_1_2_r16_present;
    group_flags[0] |= rate_match_pattern_group1_dci_1_2_r16.is_present();
    group_flags[0] |= rate_match_pattern_group2_dci_1_2_r16.is_present();
    group_flags[0] |= res_alloc_type1_granularity_dci_1_2_r16_present;
    group_flags[0] |= vrb_to_prb_interleaver_dci_1_2_r16_present;
    group_flags[0] |= ref_of_slivdci_1_2_r16_present;
    group_flags[0] |= res_alloc_dci_1_2_r16_present;
    group_flags[0] |= prio_ind_dci_1_1_r16_present;
    group_flags[0] |= data_scrambling_id_pdsch2_r16_present;
    group_flags[0] |= pdsch_time_domain_alloc_list_r16.is_present();
    group_flags[0] |= repeat_scheme_cfg_r16.is_present();
    group_flags[1] |= repeat_scheme_cfg_v1630.is_present();
    group_flags[2] |= pdsch_harq_ack_one_shot_feedback_dci_1_2_r17_present;
    group_flags[2] |= pdsch_harq_ack_enh_type3_dci_1_2_r17_present;
    group_flags[2] |= pdsch_harq_ack_enh_type3_dci_field_1_2_r17_present;
    group_flags[2] |= pdsch_harq_ack_retx_dci_1_2_r17_present;
    group_flags[2] |= pucch_s_scell_dyn_dci_1_2_r17_present;
    group_flags[2] |= dl_or_joint_tci_state_list_r17.is_present();
    group_flags[2] |= beam_app_time_r17_present;
    group_flags[2] |= dummy.is_present();
    group_flags[2] |= dmrs_fd_occ_disabled_for_rank1_pdsch_r17_present;
    group_flags[2] |= minimum_sched_offset_k0_r17.is_present();
    group_flags[2] |= harq_process_num_size_dci_1_2_v1700_present;
    group_flags[2] |= harq_process_num_size_dci_1_1_r17_present;
    group_flags[2] |= mcs_table_r17_present;
    group_flags[2] |= mcs_table_dci_1_2_r17_present;
    group_flags[2] |= xoverhead_multicast_r17_present;
    group_flags[2] |= prio_ind_dci_4_2_r17_present;
    group_flags[2] |= size_dci_4_2_r17_present;
    group_flags[3] |= pdsch_time_domain_alloc_list_for_multi_pdsch_r17.is_present();
    group_flags.pack(bref);

    if (group_flags[0]) {
      varlength_field_pack_guard varlen_scope(bref, false);

      HANDLE_CODE(bref.pack(max_mimo_layers_r16.is_present(), 1));
      HANDLE_CODE(bref.pack(minimum_sched_offset_k0_r16.is_present(), 1));
      HANDLE_CODE(bref.pack(ant_ports_field_presence_dci_1_2_r16_present, 1));
      HANDLE_CODE(bref.pack(aperiodic_zp_csi_rs_res_sets_to_add_mod_list_dci_1_2_r16.is_present(), 1));
      HANDLE_CODE(bref.pack(aperiodic_zp_csi_rs_res_sets_to_release_list_dci_1_2_r16.is_present(), 1));
      HANDLE_CODE(bref.pack(dmrs_dl_for_pdsch_map_type_a_dci_1_2_r16.is_present(), 1));
      HANDLE_CODE(bref.pack(dmrs_dl_for_pdsch_map_type_b_dci_1_2_r16.is_present(), 1));
      HANDLE_CODE(bref.pack(dmrs_seq_initization_dci_1_2_r16_present, 1));
      HANDLE_CODE(bref.pack(harq_process_num_size_dci_1_2_r16_present, 1));
      HANDLE_CODE(bref.pack(mcs_table_dci_1_2_r16_present, 1));
      HANDLE_CODE(bref.pack(nof_bits_for_rv_dci_1_2_r16_present, 1));
      HANDLE_CODE(bref.pack(pdsch_time_domain_alloc_list_dci_1_2_r16.is_present(), 1));
      HANDLE_CODE(bref.pack(prb_bundling_type_dci_1_2_r16.is_present(), 1));
      HANDLE_CODE(bref.pack(prio_ind_dci_1_2_r16_present, 1));
      HANDLE_CODE(bref.pack(rate_match_pattern_group1_dci_1_2_r16.is_present(), 1));
      HANDLE_CODE(bref.pack(rate_match_pattern_group2_dci_1_2_r16.is_present(), 1));
      HANDLE_CODE(bref.pack(res_alloc_type1_granularity_dci_1_2_r16_present, 1));
      HANDLE_CODE(bref.pack(vrb_to_prb_interleaver_dci_1_2_r16_present, 1));
      HANDLE_CODE(bref.pack(ref_of_slivdci_1_2_r16_present, 1));
      HANDLE_CODE(bref.pack(res_alloc_dci_1_2_r16_present, 1));
      HANDLE_CODE(bref.pack(prio_ind_dci_1_1_r16_present, 1));
      HANDLE_CODE(bref.pack(data_scrambling_id_pdsch2_r16_present, 1));
      HANDLE_CODE(bref.pack(pdsch_time_domain_alloc_list_r16.is_present(), 1));
      HANDLE_CODE(bref.pack(repeat_scheme_cfg_r16.is_present(), 1));
      if (max_mimo_layers_r16.is_present()) {
        HANDLE_CODE(max_mimo_layers_r16->pack(bref));
      }
      if (minimum_sched_offset_k0_r16.is_present()) {
        HANDLE_CODE(minimum_sched_offset_k0_r16->pack(bref));
      }
      if (aperiodic_zp_csi_rs_res_sets_to_add_mod_list_dci_1_2_r16.is_present()) {
        HANDLE_CODE(pack_dyn_seq_of(bref, *aperiodic_zp_csi_rs_res_sets_to_add_mod_list_dci_1_2_r16, 1, 16));
      }
      if (aperiodic_zp_csi_rs_res_sets_to_release_list_dci_1_2_r16.is_present()) {
        HANDLE_CODE(pack_dyn_seq_of(
            bref, *aperiodic_zp_csi_rs_res_sets_to_release_list_dci_1_2_r16, 1, 16, integer_packer<uint8_t>(0, 15)));
      }
      if (dmrs_dl_for_pdsch_map_type_a_dci_1_2_r16.is_present()) {
        HANDLE_CODE(dmrs_dl_for_pdsch_map_type_a_dci_1_2_r16->pack(bref));
      }
      if (dmrs_dl_for_pdsch_map_type_b_dci_1_2_r16.is_present()) {
        HANDLE_CODE(dmrs_dl_for_pdsch_map_type_b_dci_1_2_r16->pack(bref));
      }
      if (harq_process_num_size_dci_1_2_r16_present) {
        HANDLE_CODE(pack_integer(bref, harq_process_num_size_dci_1_2_r16, (uint8_t)0u, (uint8_t)4u));
      }
      if (mcs_table_dci_1_2_r16_present) {
        HANDLE_CODE(mcs_table_dci_1_2_r16.pack(bref));
      }
      if (nof_bits_for_rv_dci_1_2_r16_present) {
        HANDLE_CODE(pack_integer(bref, nof_bits_for_rv_dci_1_2_r16, (uint8_t)0u, (uint8_t)2u));
      }
      if (pdsch_time_domain_alloc_list_dci_1_2_r16.is_present()) {
        HANDLE_CODE(pdsch_time_domain_alloc_list_dci_1_2_r16->pack(bref));
      }
      if (prb_bundling_type_dci_1_2_r16.is_present()) {
        HANDLE_CODE(prb_bundling_type_dci_1_2_r16->pack(bref));
      }
      if (rate_match_pattern_group1_dci_1_2_r16.is_present()) {
        HANDLE_CODE(pack_dyn_seq_of(bref, *rate_match_pattern_group1_dci_1_2_r16, 1, 8));
      }
      if (rate_match_pattern_group2_dci_1_2_r16.is_present()) {
        HANDLE_CODE(pack_dyn_seq_of(bref, *rate_match_pattern_group2_dci_1_2_r16, 1, 8));
      }
      if (res_alloc_type1_granularity_dci_1_2_r16_present) {
        HANDLE_CODE(res_alloc_type1_granularity_dci_1_2_r16.pack(bref));
      }
      if (vrb_to_prb_interleaver_dci_1_2_r16_present) {
        HANDLE_CODE(vrb_to_prb_interleaver_dci_1_2_r16.pack(bref));
      }
      if (res_alloc_dci_1_2_r16_present) {
        HANDLE_CODE(res_alloc_dci_1_2_r16.pack(bref));
      }
      if (data_scrambling_id_pdsch2_r16_present) {
        HANDLE_CODE(pack_integer(bref, data_scrambling_id_pdsch2_r16, (uint16_t)0u, (uint16_t)1023u));
      }
      if (pdsch_time_domain_alloc_list_r16.is_present()) {
        HANDLE_CODE(pdsch_time_domain_alloc_list_r16->pack(bref));
      }
      if (repeat_scheme_cfg_r16.is_present()) {
        HANDLE_CODE(repeat_scheme_cfg_r16->pack(bref));
      }
    }
    if (group_flags[1]) {
      varlength_field_pack_guard varlen_scope(bref, false);

      HANDLE_CODE(bref.pack(repeat_scheme_cfg_v1630.is_present(), 1));
      if (repeat_scheme_cfg_v1630.is_present()) {
        HANDLE_CODE(repeat_scheme_cfg_v1630->pack(bref));
      }
    }
    if (group_flags[2]) {
      varlength_field_pack_guard varlen_scope(bref, false);

      HANDLE_CODE(bref.pack(pdsch_harq_ack_one_shot_feedback_dci_1_2_r17_present, 1));
      HANDLE_CODE(bref.pack(pdsch_harq_ack_enh_type3_dci_1_2_r17_present, 1));
      HANDLE_CODE(bref.pack(pdsch_harq_ack_enh_type3_dci_field_1_2_r17_present, 1));
      HANDLE_CODE(bref.pack(pdsch_harq_ack_retx_dci_1_2_r17_present, 1));
      HANDLE_CODE(bref.pack(pucch_s_scell_dyn_dci_1_2_r17_present, 1));
      HANDLE_CODE(bref.pack(dl_or_joint_tci_state_list_r17.is_present(), 1));
      HANDLE_CODE(bref.pack(beam_app_time_r17_present, 1));
      HANDLE_CODE(bref.pack(dummy.is_present(), 1));
      HANDLE_CODE(bref.pack(dmrs_fd_occ_disabled_for_rank1_pdsch_r17_present, 1));
      HANDLE_CODE(bref.pack(minimum_sched_offset_k0_r17.is_present(), 1));
      HANDLE_CODE(bref.pack(harq_process_num_size_dci_1_2_v1700_present, 1));
      HANDLE_CODE(bref.pack(harq_process_num_size_dci_1_1_r17_present, 1));
      HANDLE_CODE(bref.pack(mcs_table_r17_present, 1));
      HANDLE_CODE(bref.pack(mcs_table_dci_1_2_r17_present, 1));
      HANDLE_CODE(bref.pack(xoverhead_multicast_r17_present, 1));
      HANDLE_CODE(bref.pack(prio_ind_dci_4_2_r17_present, 1));
      HANDLE_CODE(bref.pack(size_dci_4_2_r17_present, 1));
      if (dl_or_joint_tci_state_list_r17.is_present()) {
        HANDLE_CODE(dl_or_joint_tci_state_list_r17->pack(bref));
      }
      if (beam_app_time_r17_present) {
        HANDLE_CODE(beam_app_time_r17.pack(bref));
      }
      if (dummy.is_present()) {
        HANDLE_CODE(dummy->pack(bref));
      }
      if (minimum_sched_offset_k0_r17.is_present()) {
        HANDLE_CODE(minimum_sched_offset_k0_r17->pack(bref));
      }
      if (harq_process_num_size_dci_1_2_v1700_present) {
        HANDLE_CODE(pack_integer(bref, harq_process_num_size_dci_1_2_v1700, (uint8_t)0u, (uint8_t)5u));
      }
      if (harq_process_num_size_dci_1_1_r17_present) {
        HANDLE_CODE(pack_integer(bref, harq_process_num_size_dci_1_1_r17, (uint8_t)5u, (uint8_t)5u));
      }
      if (xoverhead_multicast_r17_present) {
        HANDLE_CODE(xoverhead_multicast_r17.pack(bref));
      }
      if (size_dci_4_2_r17_present) {
        HANDLE_CODE(pack_integer(bref, size_dci_4_2_r17, (uint8_t)20u, (uint8_t)140u));
      }
    }
    if (group_flags[3]) {
      varlength_field_pack_guard varlen_scope(bref, false);

      HANDLE_CODE(bref.pack(pdsch_time_domain_alloc_list_for_multi_pdsch_r17.is_present(), 1));
      if (pdsch_time_domain_alloc_list_for_multi_pdsch_r17.is_present()) {
        HANDLE_CODE(pdsch_time_domain_alloc_list_for_multi_pdsch_r17->pack(bref));
      }
    }
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE pdsch_cfg_s::unpack(cbit_ref& bref)
{
  bref.unpack(ext, 1);
  HANDLE_CODE(bref.unpack(data_scrambling_id_pdsch_present, 1));
  HANDLE_CODE(bref.unpack(dmrs_dl_for_pdsch_map_type_a_present, 1));
  HANDLE_CODE(bref.unpack(dmrs_dl_for_pdsch_map_type_b_present, 1));
  bool tci_states_to_add_mod_list_present;
  HANDLE_CODE(bref.unpack(tci_states_to_add_mod_list_present, 1));
  bool tci_states_to_release_list_present;
  HANDLE_CODE(bref.unpack(tci_states_to_release_list_present, 1));
  HANDLE_CODE(bref.unpack(vrb_to_prb_interleaver_present, 1));
  HANDLE_CODE(bref.unpack(pdsch_time_domain_alloc_list_present, 1));
  HANDLE_CODE(bref.unpack(pdsch_aggregation_factor_present, 1));
  bool rate_match_pattern_to_add_mod_list_present;
  HANDLE_CODE(bref.unpack(rate_match_pattern_to_add_mod_list_present, 1));
  bool rate_match_pattern_to_release_list_present;
  HANDLE_CODE(bref.unpack(rate_match_pattern_to_release_list_present, 1));
  bool rate_match_pattern_group1_present;
  HANDLE_CODE(bref.unpack(rate_match_pattern_group1_present, 1));
  bool rate_match_pattern_group2_present;
  HANDLE_CODE(bref.unpack(rate_match_pattern_group2_present, 1));
  HANDLE_CODE(bref.unpack(mcs_table_present, 1));
  HANDLE_CODE(bref.unpack(max_nrof_code_words_sched_by_dci_present, 1));
  bool zp_csi_rs_res_to_add_mod_list_present;
  HANDLE_CODE(bref.unpack(zp_csi_rs_res_to_add_mod_list_present, 1));
  bool zp_csi_rs_res_to_release_list_present;
  HANDLE_CODE(bref.unpack(zp_csi_rs_res_to_release_list_present, 1));
  bool aperiodic_zp_csi_rs_res_sets_to_add_mod_list_present;
  HANDLE_CODE(bref.unpack(aperiodic_zp_csi_rs_res_sets_to_add_mod_list_present, 1));
  bool aperiodic_zp_csi_rs_res_sets_to_release_list_present;
  HANDLE_CODE(bref.unpack(aperiodic_zp_csi_rs_res_sets_to_release_list_present, 1));
  bool sp_zp_csi_rs_res_sets_to_add_mod_list_present;
  HANDLE_CODE(bref.unpack(sp_zp_csi_rs_res_sets_to_add_mod_list_present, 1));
  bool sp_zp_csi_rs_res_sets_to_release_list_present;
  HANDLE_CODE(bref.unpack(sp_zp_csi_rs_res_sets_to_release_list_present, 1));
  HANDLE_CODE(bref.unpack(p_zp_csi_rs_res_set_present, 1));

  if (data_scrambling_id_pdsch_present) {
    HANDLE_CODE(unpack_integer(data_scrambling_id_pdsch, bref, (uint16_t)0u, (uint16_t)1023u));
  }
  if (dmrs_dl_for_pdsch_map_type_a_present) {
    HANDLE_CODE(dmrs_dl_for_pdsch_map_type_a.unpack(bref));
  }
  if (dmrs_dl_for_pdsch_map_type_b_present) {
    HANDLE_CODE(dmrs_dl_for_pdsch_map_type_b.unpack(bref));
  }
  if (tci_states_to_add_mod_list_present) {
    HANDLE_CODE(unpack_dyn_seq_of(tci_states_to_add_mod_list, bref, 1, 128));
  }
  if (tci_states_to_release_list_present) {
    HANDLE_CODE(unpack_dyn_seq_of(tci_states_to_release_list, bref, 1, 128, integer_packer<uint8_t>(0, 127)));
  }
  if (vrb_to_prb_interleaver_present) {
    HANDLE_CODE(vrb_to_prb_interleaver.unpack(bref));
  }
  HANDLE_CODE(res_alloc.unpack(bref));
  if (pdsch_time_domain_alloc_list_present) {
    HANDLE_CODE(pdsch_time_domain_alloc_list.unpack(bref));
  }
  if (pdsch_aggregation_factor_present) {
    HANDLE_CODE(pdsch_aggregation_factor.unpack(bref));
  }
  if (rate_match_pattern_to_add_mod_list_present) {
    HANDLE_CODE(unpack_dyn_seq_of(rate_match_pattern_to_add_mod_list, bref, 1, 4));
  }
  if (rate_match_pattern_to_release_list_present) {
    HANDLE_CODE(unpack_dyn_seq_of(rate_match_pattern_to_release_list, bref, 1, 4, integer_packer<uint8_t>(0, 3)));
  }
  if (rate_match_pattern_group1_present) {
    HANDLE_CODE(unpack_dyn_seq_of(rate_match_pattern_group1, bref, 1, 8));
  }
  if (rate_match_pattern_group2_present) {
    HANDLE_CODE(unpack_dyn_seq_of(rate_match_pattern_group2, bref, 1, 8));
  }
  HANDLE_CODE(rbg_size.unpack(bref));
  if (mcs_table_present) {
    HANDLE_CODE(mcs_table.unpack(bref));
  }
  if (max_nrof_code_words_sched_by_dci_present) {
    HANDLE_CODE(max_nrof_code_words_sched_by_dci.unpack(bref));
  }
  HANDLE_CODE(prb_bundling_type.unpack(bref));
  if (zp_csi_rs_res_to_add_mod_list_present) {
    HANDLE_CODE(unpack_dyn_seq_of(zp_csi_rs_res_to_add_mod_list, bref, 1, 32));
  }
  if (zp_csi_rs_res_to_release_list_present) {
    HANDLE_CODE(unpack_dyn_seq_of(zp_csi_rs_res_to_release_list, bref, 1, 32, integer_packer<uint8_t>(0, 31)));
  }
  if (aperiodic_zp_csi_rs_res_sets_to_add_mod_list_present) {
    HANDLE_CODE(unpack_dyn_seq_of(aperiodic_zp_csi_rs_res_sets_to_add_mod_list, bref, 1, 16));
  }
  if (aperiodic_zp_csi_rs_res_sets_to_release_list_present) {
    HANDLE_CODE(
        unpack_dyn_seq_of(aperiodic_zp_csi_rs_res_sets_to_release_list, bref, 1, 16, integer_packer<uint8_t>(0, 15)));
  }
  if (sp_zp_csi_rs_res_sets_to_add_mod_list_present) {
    HANDLE_CODE(unpack_dyn_seq_of(sp_zp_csi_rs_res_sets_to_add_mod_list, bref, 1, 16));
  }
  if (sp_zp_csi_rs_res_sets_to_release_list_present) {
    HANDLE_CODE(unpack_dyn_seq_of(sp_zp_csi_rs_res_sets_to_release_list, bref, 1, 16, integer_packer<uint8_t>(0, 15)));
  }
  if (p_zp_csi_rs_res_set_present) {
    HANDLE_CODE(p_zp_csi_rs_res_set.unpack(bref));
  }

  if (ext) {
    ext_groups_unpacker_guard group_flags(4);
    group_flags.unpack(bref);

    if (group_flags[0]) {
      varlength_field_unpack_guard varlen_scope(bref, false);

      unpack_presence_flag(max_mimo_layers_r16, bref);
      unpack_presence_flag(minimum_sched_offset_k0_r16, bref);
      HANDLE_CODE(bref.unpack(ant_ports_field_presence_dci_1_2_r16_present, 1));
      unpack_presence_flag(aperiodic_zp_csi_rs_res_sets_to_add_mod_list_dci_1_2_r16, bref);
      unpack_presence_flag(aperiodic_zp_csi_rs_res_sets_to_release_list_dci_1_2_r16, bref);
      unpack_presence_flag(dmrs_dl_for_pdsch_map_type_a_dci_1_2_r16, bref);
      unpack_presence_flag(dmrs_dl_for_pdsch_map_type_b_dci_1_2_r16, bref);
      HANDLE_CODE(bref.unpack(dmrs_seq_initization_dci_1_2_r16_present, 1));
      HANDLE_CODE(bref.unpack(harq_process_num_size_dci_1_2_r16_present, 1));
      HANDLE_CODE(bref.unpack(mcs_table_dci_1_2_r16_present, 1));
      HANDLE_CODE(bref.unpack(nof_bits_for_rv_dci_1_2_r16_present, 1));
      unpack_presence_flag(pdsch_time_domain_alloc_list_dci_1_2_r16, bref);
      unpack_presence_flag(prb_bundling_type_dci_1_2_r16, bref);
      HANDLE_CODE(bref.unpack(prio_ind_dci_1_2_r16_present, 1));
      unpack_presence_flag(rate_match_pattern_group1_dci_1_2_r16, bref);
      unpack_presence_flag(rate_match_pattern_group2_dci_1_2_r16, bref);
      HANDLE_CODE(bref.unpack(res_alloc_type1_granularity_dci_1_2_r16_present, 1));
      HANDLE_CODE(bref.unpack(vrb_to_prb_interleaver_dci_1_2_r16_present, 1));
      HANDLE_CODE(bref.unpack(ref_of_slivdci_1_2_r16_present, 1));
      HANDLE_CODE(bref.unpack(res_alloc_dci_1_2_r16_present, 1));
      HANDLE_CODE(bref.unpack(prio_ind_dci_1_1_r16_present, 1));
      HANDLE_CODE(bref.unpack(data_scrambling_id_pdsch2_r16_present, 1));
      unpack_presence_flag(pdsch_time_domain_alloc_list_r16, bref);
      unpack_presence_flag(repeat_scheme_cfg_r16, bref);
      if (max_mimo_layers_r16.is_present()) {
        HANDLE_CODE(max_mimo_layers_r16->unpack(bref));
      }
      if (minimum_sched_offset_k0_r16.is_present()) {
        HANDLE_CODE(minimum_sched_offset_k0_r16->unpack(bref));
      }
      if (aperiodic_zp_csi_rs_res_sets_to_add_mod_list_dci_1_2_r16.is_present()) {
        HANDLE_CODE(unpack_dyn_seq_of(*aperiodic_zp_csi_rs_res_sets_to_add_mod_list_dci_1_2_r16, bref, 1, 16));
      }
      if (aperiodic_zp_csi_rs_res_sets_to_release_list_dci_1_2_r16.is_present()) {
        HANDLE_CODE(unpack_dyn_seq_of(
            *aperiodic_zp_csi_rs_res_sets_to_release_list_dci_1_2_r16, bref, 1, 16, integer_packer<uint8_t>(0, 15)));
      }
      if (dmrs_dl_for_pdsch_map_type_a_dci_1_2_r16.is_present()) {
        HANDLE_CODE(dmrs_dl_for_pdsch_map_type_a_dci_1_2_r16->unpack(bref));
      }
      if (dmrs_dl_for_pdsch_map_type_b_dci_1_2_r16.is_present()) {
        HANDLE_CODE(dmrs_dl_for_pdsch_map_type_b_dci_1_2_r16->unpack(bref));
      }
      if (harq_process_num_size_dci_1_2_r16_present) {
        HANDLE_CODE(unpack_integer(harq_process_num_size_dci_1_2_r16, bref, (uint8_t)0u, (uint8_t)4u));
      }
      if (mcs_table_dci_1_2_r16_present) {
        HANDLE_CODE(mcs_table_dci_1_2_r16.unpack(bref));
      }
      if (nof_bits_for_rv_dci_1_2_r16_present) {
        HANDLE_CODE(unpack_integer(nof_bits_for_rv_dci_1_2_r16, bref, (uint8_t)0u, (uint8_t)2u));
      }
      if (pdsch_time_domain_alloc_list_dci_1_2_r16.is_present()) {
        HANDLE_CODE(pdsch_time_domain_alloc_list_dci_1_2_r16->unpack(bref));
      }
      if (prb_bundling_type_dci_1_2_r16.is_present()) {
        HANDLE_CODE(prb_bundling_type_dci_1_2_r16->unpack(bref));
      }
      if (rate_match_pattern_group1_dci_1_2_r16.is_present()) {
        HANDLE_CODE(unpack_dyn_seq_of(*rate_match_pattern_group1_dci_1_2_r16, bref, 1, 8));
      }
      if (rate_match_pattern_group2_dci_1_2_r16.is_present()) {
        HANDLE_CODE(unpack_dyn_seq_of(*rate_match_pattern_group2_dci_1_2_r16, bref, 1, 8));
      }
      if (res_alloc_type1_granularity_dci_1_2_r16_present) {
        HANDLE_CODE(res_alloc_type1_granularity_dci_1_2_r16.unpack(bref));
      }
      if (vrb_to_prb_interleaver_dci_1_2_r16_present) {
        HANDLE_CODE(vrb_to_prb_interleaver_dci_1_2_r16.unpack(bref));
      }
      if (res_alloc_dci_1_2_r16_present) {
        HANDLE_CODE(res_alloc_dci_1_2_r16.unpack(bref));
      }
      if (data_scrambling_id_pdsch2_r16_present) {
        HANDLE_CODE(unpack_integer(data_scrambling_id_pdsch2_r16, bref, (uint16_t)0u, (uint16_t)1023u));
      }
      if (pdsch_time_domain_alloc_list_r16.is_present()) {
        HANDLE_CODE(pdsch_time_domain_alloc_list_r16->unpack(bref));
      }
      if (repeat_scheme_cfg_r16.is_present()) {
        HANDLE_CODE(repeat_scheme_cfg_r16->unpack(bref));
      }
    }
    if (group_flags[1]) {
      varlength_field_unpack_guard varlen_scope(bref, false);

      unpack_presence_flag(repeat_scheme_cfg_v1630, bref);
      if (repeat_scheme_cfg_v1630.is_present()) {
        HANDLE_CODE(repeat_scheme_cfg_v1630->unpack(bref));
      }
    }
    if (group_flags[2]) {
      varlength_field_unpack_guard varlen_scope(bref, false);

      HANDLE_CODE(bref.unpack(pdsch_harq_ack_one_shot_feedback_dci_1_2_r17_present, 1));
      HANDLE_CODE(bref.unpack(pdsch_harq_ack_enh_type3_dci_1_2_r17_present, 1));
      HANDLE_CODE(bref.unpack(pdsch_harq_ack_enh_type3_dci_field_1_2_r17_present, 1));
      HANDLE_CODE(bref.unpack(pdsch_harq_ack_retx_dci_1_2_r17_present, 1));
      HANDLE_CODE(bref.unpack(pucch_s_scell_dyn_dci_1_2_r17_present, 1));
      unpack_presence_flag(dl_or_joint_tci_state_list_r17, bref);
      HANDLE_CODE(bref.unpack(beam_app_time_r17_present, 1));
      unpack_presence_flag(dummy, bref);
      HANDLE_CODE(bref.unpack(dmrs_fd_occ_disabled_for_rank1_pdsch_r17_present, 1));
      unpack_presence_flag(minimum_sched_offset_k0_r17, bref);
      HANDLE_CODE(bref.unpack(harq_process_num_size_dci_1_2_v1700_present, 1));
      HANDLE_CODE(bref.unpack(harq_process_num_size_dci_1_1_r17_present, 1));
      HANDLE_CODE(bref.unpack(mcs_table_r17_present, 1));
      HANDLE_CODE(bref.unpack(mcs_table_dci_1_2_r17_present, 1));
      HANDLE_CODE(bref.unpack(xoverhead_multicast_r17_present, 1));
      HANDLE_CODE(bref.unpack(prio_ind_dci_4_2_r17_present, 1));
      HANDLE_CODE(bref.unpack(size_dci_4_2_r17_present, 1));
      if (dl_or_joint_tci_state_list_r17.is_present()) {
        HANDLE_CODE(dl_or_joint_tci_state_list_r17->unpack(bref));
      }
      if (beam_app_time_r17_present) {
        HANDLE_CODE(beam_app_time_r17.unpack(bref));
      }
      if (dummy.is_present()) {
        HANDLE_CODE(dummy->unpack(bref));
      }
      if (minimum_sched_offset_k0_r17.is_present()) {
        HANDLE_CODE(minimum_sched_offset_k0_r17->unpack(bref));
      }
      if (harq_process_num_size_dci_1_2_v1700_present) {
        HANDLE_CODE(unpack_integer(harq_process_num_size_dci_1_2_v1700, bref, (uint8_t)0u, (uint8_t)5u));
      }
      if (harq_process_num_size_dci_1_1_r17_present) {
        HANDLE_CODE(unpack_integer(harq_process_num_size_dci_1_1_r17, bref, (uint8_t)5u, (uint8_t)5u));
      }
      if (xoverhead_multicast_r17_present) {
        HANDLE_CODE(xoverhead_multicast_r17.unpack(bref));
      }
      if (size_dci_4_2_r17_present) {
        HANDLE_CODE(unpack_integer(size_dci_4_2_r17, bref, (uint8_t)20u, (uint8_t)140u));
      }
    }
    if (group_flags[3]) {
      varlength_field_unpack_guard varlen_scope(bref, false);

      unpack_presence_flag(pdsch_time_domain_alloc_list_for_multi_pdsch_r17, bref);
      if (pdsch_time_domain_alloc_list_for_multi_pdsch_r17.is_present()) {
        HANDLE_CODE(pdsch_time_domain_alloc_list_for_multi_pdsch_r17->unpack(bref));
      }
    }
  }
  return SRSASN_SUCCESS;
}
void pdsch_cfg_s::to_json(json_writer& j) const
{
  j.start_obj();
  if (data_scrambling_id_pdsch_present) {
    j.write_int("dataScramblingIdentityPDSCH", data_scrambling_id_pdsch);
  }
  if (dmrs_dl_for_pdsch_map_type_a_present) {
    j.write_fieldname("dmrs-DownlinkForPDSCH-MappingTypeA");
    dmrs_dl_for_pdsch_map_type_a.to_json(j);
  }
  if (dmrs_dl_for_pdsch_map_type_b_present) {
    j.write_fieldname("dmrs-DownlinkForPDSCH-MappingTypeB");
    dmrs_dl_for_pdsch_map_type_b.to_json(j);
  }
  if (tci_states_to_add_mod_list.size() > 0) {
    j.start_array("tci-StatesToAddModList");
    for (const auto& e1 : tci_states_to_add_mod_list) {
      e1.to_json(j);
    }
    j.end_array();
  }
  if (tci_states_to_release_list.size() > 0) {
    j.start_array("tci-StatesToReleaseList");
    for (const auto& e1 : tci_states_to_release_list) {
      j.write_int(e1);
    }
    j.end_array();
  }
  if (vrb_to_prb_interleaver_present) {
    j.write_str("vrb-ToPRB-Interleaver", vrb_to_prb_interleaver.to_string());
  }
  j.write_str("resourceAllocation", res_alloc.to_string());
  if (pdsch_time_domain_alloc_list_present) {
    j.write_fieldname("pdsch-TimeDomainAllocationList");
    pdsch_time_domain_alloc_list.to_json(j);
  }
  if (pdsch_aggregation_factor_present) {
    j.write_str("pdsch-AggregationFactor", pdsch_aggregation_factor.to_string());
  }
  if (rate_match_pattern_to_add_mod_list.size() > 0) {
    j.start_array("rateMatchPatternToAddModList");
    for (const auto& e1 : rate_match_pattern_to_add_mod_list) {
      e1.to_json(j);
    }
    j.end_array();
  }
  if (rate_match_pattern_to_release_list.size() > 0) {
    j.start_array("rateMatchPatternToReleaseList");
    for (const auto& e1 : rate_match_pattern_to_release_list) {
      j.write_int(e1);
    }
    j.end_array();
  }
  if (rate_match_pattern_group1.size() > 0) {
    j.start_array("rateMatchPatternGroup1");
    for (const auto& e1 : rate_match_pattern_group1) {
      e1.to_json(j);
    }
    j.end_array();
  }
  if (rate_match_pattern_group2.size() > 0) {
    j.start_array("rateMatchPatternGroup2");
    for (const auto& e1 : rate_match_pattern_group2) {
      e1.to_json(j);
    }
    j.end_array();
  }
  j.write_str("rbg-Size", rbg_size.to_string());
  if (mcs_table_present) {
    j.write_str("mcs-Table", mcs_table.to_string());
  }
  if (max_nrof_code_words_sched_by_dci_present) {
    j.write_str("maxNrofCodeWordsScheduledByDCI", max_nrof_code_words_sched_by_dci.to_string());
  }
  j.write_fieldname("prb-BundlingType");
  prb_bundling_type.to_json(j);
  if (zp_csi_rs_res_to_add_mod_list.size() > 0) {
    j.start_array("zp-CSI-RS-ResourceToAddModList");
    for (const auto& e1 : zp_csi_rs_res_to_add_mod_list) {
      e1.to_json(j);
    }
    j.end_array();
  }
  if (zp_csi_rs_res_to_release_list.size() > 0) {
    j.start_array("zp-CSI-RS-ResourceToReleaseList");
    for (const auto& e1 : zp_csi_rs_res_to_release_list) {
      j.write_int(e1);
    }
    j.end_array();
  }
  if (aperiodic_zp_csi_rs_res_sets_to_add_mod_list.size() > 0) {
    j.start_array("aperiodic-ZP-CSI-RS-ResourceSetsToAddModList");
    for (const auto& e1 : aperiodic_zp_csi_rs_res_sets_to_add_mod_list) {
      e1.to_json(j);
    }
    j.end_array();
  }
  if (aperiodic_zp_csi_rs_res_sets_to_release_list.size() > 0) {
    j.start_array("aperiodic-ZP-CSI-RS-ResourceSetsToReleaseList");
    for (const auto& e1 : aperiodic_zp_csi_rs_res_sets_to_release_list) {
      j.write_int(e1);
    }
    j.end_array();
  }
  if (sp_zp_csi_rs_res_sets_to_add_mod_list.size() > 0) {
    j.start_array("sp-ZP-CSI-RS-ResourceSetsToAddModList");
    for (const auto& e1 : sp_zp_csi_rs_res_sets_to_add_mod_list) {
      e1.to_json(j);
    }
    j.end_array();
  }
  if (sp_zp_csi_rs_res_sets_to_release_list.size() > 0) {
    j.start_array("sp-ZP-CSI-RS-ResourceSetsToReleaseList");
    for (const auto& e1 : sp_zp_csi_rs_res_sets_to_release_list) {
      j.write_int(e1);
    }
    j.end_array();
  }
  if (p_zp_csi_rs_res_set_present) {
    j.write_fieldname("p-ZP-CSI-RS-ResourceSet");
    p_zp_csi_rs_res_set.to_json(j);
  }
  if (ext) {
    if (max_mimo_layers_r16.is_present()) {
      j.write_fieldname("maxMIMO-Layers-r16");
      max_mimo_layers_r16->to_json(j);
    }
    if (minimum_sched_offset_k0_r16.is_present()) {
      j.write_fieldname("minimumSchedulingOffsetK0-r16");
      minimum_sched_offset_k0_r16->to_json(j);
    }
    if (ant_ports_field_presence_dci_1_2_r16_present) {
      j.write_str("antennaPortsFieldPresenceDCI-1-2-r16", "enabled");
    }
    if (aperiodic_zp_csi_rs_res_sets_to_add_mod_list_dci_1_2_r16.is_present()) {
      j.start_array("aperiodicZP-CSI-RS-ResourceSetsToAddModListDCI-1-2-r16");
      for (const auto& e1 : *aperiodic_zp_csi_rs_res_sets_to_add_mod_list_dci_1_2_r16) {
        e1.to_json(j);
      }
      j.end_array();
    }
    if (aperiodic_zp_csi_rs_res_sets_to_release_list_dci_1_2_r16.is_present()) {
      j.start_array("aperiodicZP-CSI-RS-ResourceSetsToReleaseListDCI-1-2-r16");
      for (const auto& e1 : *aperiodic_zp_csi_rs_res_sets_to_release_list_dci_1_2_r16) {
        j.write_int(e1);
      }
      j.end_array();
    }
    if (dmrs_dl_for_pdsch_map_type_a_dci_1_2_r16.is_present()) {
      j.write_fieldname("dmrs-DownlinkForPDSCH-MappingTypeA-DCI-1-2-r16");
      dmrs_dl_for_pdsch_map_type_a_dci_1_2_r16->to_json(j);
    }
    if (dmrs_dl_for_pdsch_map_type_b_dci_1_2_r16.is_present()) {
      j.write_fieldname("dmrs-DownlinkForPDSCH-MappingTypeB-DCI-1-2-r16");
      dmrs_dl_for_pdsch_map_type_b_dci_1_2_r16->to_json(j);
    }
    if (dmrs_seq_initization_dci_1_2_r16_present) {
      j.write_str("dmrs-SequenceInitializationDCI-1-2-r16", "enabled");
    }
    if (harq_process_num_size_dci_1_2_r16_present) {
      j.write_int("harq-ProcessNumberSizeDCI-1-2-r16", harq_process_num_size_dci_1_2_r16);
    }
    if (mcs_table_dci_1_2_r16_present) {
      j.write_str("mcs-TableDCI-1-2-r16", mcs_table_dci_1_2_r16.to_string());
    }
    if (nof_bits_for_rv_dci_1_2_r16_present) {
      j.write_int("numberOfBitsForRV-DCI-1-2-r16", nof_bits_for_rv_dci_1_2_r16);
    }
    if (pdsch_time_domain_alloc_list_dci_1_2_r16.is_present()) {
      j.write_fieldname("pdsch-TimeDomainAllocationListDCI-1-2-r16");
      pdsch_time_domain_alloc_list_dci_1_2_r16->to_json(j);
    }
    if (prb_bundling_type_dci_1_2_r16.is_present()) {
      j.write_fieldname("prb-BundlingTypeDCI-1-2-r16");
      prb_bundling_type_dci_1_2_r16->to_json(j);
    }
    if (prio_ind_dci_1_2_r16_present) {
      j.write_str("priorityIndicatorDCI-1-2-r16", "enabled");
    }
    if (rate_match_pattern_group1_dci_1_2_r16.is_present()) {
      j.start_array("rateMatchPatternGroup1DCI-1-2-r16");
      for (const auto& e1 : *rate_match_pattern_group1_dci_1_2_r16) {
        e1.to_json(j);
      }
      j.end_array();
    }
    if (rate_match_pattern_group2_dci_1_2_r16.is_present()) {
      j.start_array("rateMatchPatternGroup2DCI-1-2-r16");
      for (const auto& e1 : *rate_match_pattern_group2_dci_1_2_r16) {
        e1.to_json(j);
      }
      j.end_array();
    }
    if (res_alloc_type1_granularity_dci_1_2_r16_present) {
      j.write_str("resourceAllocationType1GranularityDCI-1-2-r16", res_alloc_type1_granularity_dci_1_2_r16.to_string());
    }
    if (vrb_to_prb_interleaver_dci_1_2_r16_present) {
      j.write_str("vrb-ToPRB-InterleaverDCI-1-2-r16", vrb_to_prb_interleaver_dci_1_2_r16.to_string());
    }
    if (ref_of_slivdci_1_2_r16_present) {
      j.write_str("referenceOfSLIVDCI-1-2-r16", "enabled");
    }
    if (res_alloc_dci_1_2_r16_present) {
      j.write_str("resourceAllocationDCI-1-2-r16", res_alloc_dci_1_2_r16.to_string());
    }
    if (prio_ind_dci_1_1_r16_present) {
      j.write_str("priorityIndicatorDCI-1-1-r16", "enabled");
    }
    if (data_scrambling_id_pdsch2_r16_present) {
      j.write_int("dataScramblingIdentityPDSCH2-r16", data_scrambling_id_pdsch2_r16);
    }
    if (pdsch_time_domain_alloc_list_r16.is_present()) {
      j.write_fieldname("pdsch-TimeDomainAllocationList-r16");
      pdsch_time_domain_alloc_list_r16->to_json(j);
    }
    if (repeat_scheme_cfg_r16.is_present()) {
      j.write_fieldname("repetitionSchemeConfig-r16");
      repeat_scheme_cfg_r16->to_json(j);
    }
    if (repeat_scheme_cfg_v1630.is_present()) {
      j.write_fieldname("repetitionSchemeConfig-v1630");
      repeat_scheme_cfg_v1630->to_json(j);
    }
    if (pdsch_harq_ack_one_shot_feedback_dci_1_2_r17_present) {
      j.write_str("pdsch-HARQ-ACK-OneShotFeedbackDCI-1-2-r17", "enabled");
    }
    if (pdsch_harq_ack_enh_type3_dci_1_2_r17_present) {
      j.write_str("pdsch-HARQ-ACK-EnhType3DCI-1-2-r17", "enabled");
    }
    if (pdsch_harq_ack_enh_type3_dci_field_1_2_r17_present) {
      j.write_str("pdsch-HARQ-ACK-EnhType3DCI-Field-1-2-r17", "enabled");
    }
    if (pdsch_harq_ack_retx_dci_1_2_r17_present) {
      j.write_str("pdsch-HARQ-ACK-RetxDCI-1-2-r17", "enabled");
    }
    if (pucch_s_scell_dyn_dci_1_2_r17_present) {
      j.write_str("pucch-sSCellDynDCI-1-2-r17", "enabled");
    }
    if (dl_or_joint_tci_state_list_r17.is_present()) {
      j.write_fieldname("dl-OrJointTCI-StateList-r17");
      dl_or_joint_tci_state_list_r17->to_json(j);
    }
    if (beam_app_time_r17_present) {
      j.write_str("beamAppTime-r17", beam_app_time_r17.to_string());
    }
    if (dummy.is_present()) {
      j.write_fieldname("dummy");
      dummy->to_json(j);
    }
    if (dmrs_fd_occ_disabled_for_rank1_pdsch_r17_present) {
      j.write_str("dmrs-FD-OCC-DisabledForRank1-PDSCH-r17", "true");
    }
    if (minimum_sched_offset_k0_r17.is_present()) {
      j.write_fieldname("minimumSchedulingOffsetK0-r17");
      minimum_sched_offset_k0_r17->to_json(j);
    }
    if (harq_process_num_size_dci_1_2_v1700_present) {
      j.write_int("harq-ProcessNumberSizeDCI-1-2-v1700", harq_process_num_size_dci_1_2_v1700);
    }
    if (harq_process_num_size_dci_1_1_r17_present) {
      j.write_int("harq-ProcessNumberSizeDCI-1-1-r17", harq_process_num_size_dci_1_1_r17);
    }
    if (mcs_table_r17_present) {
      j.write_str("mcs-Table-r17", "qam1024");
    }
    if (mcs_table_dci_1_2_r17_present) {
      j.write_str("mcs-TableDCI-1-2-r17", "qam1024");
    }
    if (xoverhead_multicast_r17_present) {
      j.write_str("xOverheadMulticast-r17", xoverhead_multicast_r17.to_string());
    }
    if (prio_ind_dci_4_2_r17_present) {
      j.write_str("priorityIndicatorDCI-4-2-r17", "enabled");
    }
    if (size_dci_4_2_r17_present) {
      j.write_int("sizeDCI-4-2-r17", size_dci_4_2_r17);
    }
    if (pdsch_time_domain_alloc_list_for_multi_pdsch_r17.is_present()) {
      j.write_fieldname("pdsch-TimeDomainAllocationListForMultiPDSCH-r17");
      pdsch_time_domain_alloc_list_for_multi_pdsch_r17->to_json(j);
    }
  }
  j.end_obj();
}

const char* pdsch_cfg_s::vrb_to_prb_interleaver_opts::to_string() const
{
  static const char* names[] = {"n2", "n4"};
  return convert_enum_idx(names, 2, value, "pdsch_cfg_s::vrb_to_prb_interleaver_e_");
}
uint8_t pdsch_cfg_s::vrb_to_prb_interleaver_opts::to_number() const
{
  static const uint8_t numbers[] = {2, 4};
  return map_enum_number(numbers, 2, value, "pdsch_cfg_s::vrb_to_prb_interleaver_e_");
}

const char* pdsch_cfg_s::res_alloc_opts::to_string() const
{
  static const char* names[] = {"resourceAllocationType0", "resourceAllocationType1", "dynamicSwitch"};
  return convert_enum_idx(names, 3, value, "pdsch_cfg_s::res_alloc_e_");
}
uint8_t pdsch_cfg_s::res_alloc_opts::to_number() const
{
  static const uint8_t numbers[] = {0, 1};
  return map_enum_number(numbers, 2, value, "pdsch_cfg_s::res_alloc_e_");
}

const char* pdsch_cfg_s::pdsch_aggregation_factor_opts::to_string() const
{
  static const char* names[] = {"n2", "n4", "n8"};
  return convert_enum_idx(names, 3, value, "pdsch_cfg_s::pdsch_aggregation_factor_e_");
}
uint8_t pdsch_cfg_s::pdsch_aggregation_factor_opts::to_number() const
{
  static const uint8_t numbers[] = {2, 4, 8};
  return map_enum_number(numbers, 3, value, "pdsch_cfg_s::pdsch_aggregation_factor_e_");
}

const char* pdsch_cfg_s::rbg_size_opts::to_string() const
{
  static const char* names[] = {"config1", "config2"};
  return convert_enum_idx(names, 2, value, "pdsch_cfg_s::rbg_size_e_");
}
uint8_t pdsch_cfg_s::rbg_size_opts::to_number() const
{
  static const uint8_t numbers[] = {1, 2};
  return map_enum_number(numbers, 2, value, "pdsch_cfg_s::rbg_size_e_");
}

const char* pdsch_cfg_s::mcs_table_opts::to_string() const
{
  static const char* names[] = {"qam256", "qam64LowSE"};
  return convert_enum_idx(names, 2, value, "pdsch_cfg_s::mcs_table_e_");
}
uint16_t pdsch_cfg_s::mcs_table_opts::to_number() const
{
  static const uint16_t numbers[] = {256, 64};
  return map_enum_number(numbers, 2, value, "pdsch_cfg_s::mcs_table_e_");
}

const char* pdsch_cfg_s::max_nrof_code_words_sched_by_dci_opts::to_string() const
{
  static const char* names[] = {"n1", "n2"};
  return convert_enum_idx(names, 2, value, "pdsch_cfg_s::max_nrof_code_words_sched_by_dci_e_");
}
uint8_t pdsch_cfg_s::max_nrof_code_words_sched_by_dci_opts::to_number() const
{
  static const uint8_t numbers[] = {1, 2};
  return map_enum_number(numbers, 2, value, "pdsch_cfg_s::max_nrof_code_words_sched_by_dci_e_");
}

void pdsch_cfg_s::prb_bundling_type_c_::destroy_()
{
  switch (type_) {
    case types::static_bundling:
      c.destroy<static_bundling_s_>();
      break;
    case types::dyn_bundling:
      c.destroy<dyn_bundling_s_>();
      break;
    default:
      break;
  }
}
void pdsch_cfg_s::prb_bundling_type_c_::set(types::options e)
{
  destroy_();
  type_ = e;
  switch (type_) {
    case types::static_bundling:
      c.init<static_bundling_s_>();
      break;
    case types::dyn_bundling:
      c.init<dyn_bundling_s_>();
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "pdsch_cfg_s::prb_bundling_type_c_");
  }
}
pdsch_cfg_s::prb_bundling_type_c_::prb_bundling_type_c_(const pdsch_cfg_s::prb_bundling_type_c_& other)
{
  type_ = other.type();
  switch (type_) {
    case types::static_bundling:
      c.init(other.c.get<static_bundling_s_>());
      break;
    case types::dyn_bundling:
      c.init(other.c.get<dyn_bundling_s_>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "pdsch_cfg_s::prb_bundling_type_c_");
  }
}
pdsch_cfg_s::prb_bundling_type_c_&
pdsch_cfg_s::prb_bundling_type_c_::operator=(const pdsch_cfg_s::prb_bundling_type_c_& other)
{
  if (this == &other) {
    return *this;
  }
  set(other.type());
  switch (type_) {
    case types::static_bundling:
      c.set(other.c.get<static_bundling_s_>());
      break;
    case types::dyn_bundling:
      c.set(other.c.get<dyn_bundling_s_>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "pdsch_cfg_s::prb_bundling_type_c_");
  }

  return *this;
}
pdsch_cfg_s::prb_bundling_type_c_::static_bundling_s_& pdsch_cfg_s::prb_bundling_type_c_::set_static_bundling()
{
  set(types::static_bundling);
  return c.get<static_bundling_s_>();
}
pdsch_cfg_s::prb_bundling_type_c_::dyn_bundling_s_& pdsch_cfg_s::prb_bundling_type_c_::set_dyn_bundling()
{
  set(types::dyn_bundling);
  return c.get<dyn_bundling_s_>();
}
void pdsch_cfg_s::prb_bundling_type_c_::to_json(json_writer& j) const
{
  j.start_obj();
  switch (type_) {
    case types::static_bundling:
      j.write_fieldname("staticBundling");
      j.start_obj();
      if (c.get<static_bundling_s_>().bundle_size_present) {
        j.write_str("bundleSize", c.get<static_bundling_s_>().bundle_size.to_string());
      }
      j.end_obj();
      break;
    case types::dyn_bundling:
      j.write_fieldname("dynamicBundling");
      j.start_obj();
      if (c.get<dyn_bundling_s_>().bundle_size_set1_present) {
        j.write_str("bundleSizeSet1", c.get<dyn_bundling_s_>().bundle_size_set1.to_string());
      }
      if (c.get<dyn_bundling_s_>().bundle_size_set2_present) {
        j.write_str("bundleSizeSet2", c.get<dyn_bundling_s_>().bundle_size_set2.to_string());
      }
      j.end_obj();
      break;
    default:
      log_invalid_choice_id(type_, "pdsch_cfg_s::prb_bundling_type_c_");
  }
  j.end_obj();
}
SRSASN_CODE pdsch_cfg_s::prb_bundling_type_c_::pack(bit_ref& bref) const
{
  type_.pack(bref);
  switch (type_) {
    case types::static_bundling:
      HANDLE_CODE(bref.pack(c.get<static_bundling_s_>().bundle_size_present, 1));
      if (c.get<static_bundling_s_>().bundle_size_present) {
        HANDLE_CODE(c.get<static_bundling_s_>().bundle_size.pack(bref));
      }
      break;
    case types::dyn_bundling:
      HANDLE_CODE(bref.pack(c.get<dyn_bundling_s_>().bundle_size_set1_present, 1));
      HANDLE_CODE(bref.pack(c.get<dyn_bundling_s_>().bundle_size_set2_present, 1));
      if (c.get<dyn_bundling_s_>().bundle_size_set1_present) {
        HANDLE_CODE(c.get<dyn_bundling_s_>().bundle_size_set1.pack(bref));
      }
      if (c.get<dyn_bundling_s_>().bundle_size_set2_present) {
        HANDLE_CODE(c.get<dyn_bundling_s_>().bundle_size_set2.pack(bref));
      }
      break;
    default:
      log_invalid_choice_id(type_, "pdsch_cfg_s::prb_bundling_type_c_");
      return SRSASN_ERROR_ENCODE_FAIL;
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE pdsch_cfg_s::prb_bundling_type_c_::unpack(cbit_ref& bref)
{
  types e;
  e.unpack(bref);
  set(e);
  switch (type_) {
    case types::static_bundling:
      HANDLE_CODE(bref.unpack(c.get<static_bundling_s_>().bundle_size_present, 1));
      if (c.get<static_bundling_s_>().bundle_size_present) {
        HANDLE_CODE(c.get<static_bundling_s_>().bundle_size.unpack(bref));
      }
      break;
    case types::dyn_bundling:
      HANDLE_CODE(bref.unpack(c.get<dyn_bundling_s_>().bundle_size_set1_present, 1));
      HANDLE_CODE(bref.unpack(c.get<dyn_bundling_s_>().bundle_size_set2_present, 1));
      if (c.get<dyn_bundling_s_>().bundle_size_set1_present) {
        HANDLE_CODE(c.get<dyn_bundling_s_>().bundle_size_set1.unpack(bref));
      }
      if (c.get<dyn_bundling_s_>().bundle_size_set2_present) {
        HANDLE_CODE(c.get<dyn_bundling_s_>().bundle_size_set2.unpack(bref));
      }
      break;
    default:
      log_invalid_choice_id(type_, "pdsch_cfg_s::prb_bundling_type_c_");
      return SRSASN_ERROR_DECODE_FAIL;
  }
  return SRSASN_SUCCESS;
}

const char* pdsch_cfg_s::prb_bundling_type_c_::static_bundling_s_::bundle_size_opts::to_string() const
{
  static const char* names[] = {"n4", "wideband"};
  return convert_enum_idx(names, 2, value, "pdsch_cfg_s::prb_bundling_type_c_::static_bundling_s_::bundle_size_e_");
}
uint8_t pdsch_cfg_s::prb_bundling_type_c_::static_bundling_s_::bundle_size_opts::to_number() const
{
  static const uint8_t numbers[] = {4};
  return map_enum_number(numbers, 1, value, "pdsch_cfg_s::prb_bundling_type_c_::static_bundling_s_::bundle_size_e_");
}

const char* pdsch_cfg_s::prb_bundling_type_c_::dyn_bundling_s_::bundle_size_set1_opts::to_string() const
{
  static const char* names[] = {"n4", "wideband", "n2-wideband", "n4-wideband"};
  return convert_enum_idx(names, 4, value, "pdsch_cfg_s::prb_bundling_type_c_::dyn_bundling_s_::bundle_size_set1_e_");
}

const char* pdsch_cfg_s::prb_bundling_type_c_::dyn_bundling_s_::bundle_size_set2_opts::to_string() const
{
  static const char* names[] = {"n4", "wideband"};
  return convert_enum_idx(names, 2, value, "pdsch_cfg_s::prb_bundling_type_c_::dyn_bundling_s_::bundle_size_set2_e_");
}
uint8_t pdsch_cfg_s::prb_bundling_type_c_::dyn_bundling_s_::bundle_size_set2_opts::to_number() const
{
  static const uint8_t numbers[] = {4};
  return map_enum_number(numbers, 1, value, "pdsch_cfg_s::prb_bundling_type_c_::dyn_bundling_s_::bundle_size_set2_e_");
}

const char* pdsch_cfg_s::prb_bundling_type_c_::types_opts::to_string() const
{
  static const char* names[] = {"staticBundling", "dynamicBundling"};
  return convert_enum_idx(names, 2, value, "pdsch_cfg_s::prb_bundling_type_c_::types");
}

const char* pdsch_cfg_s::mcs_table_dci_1_2_r16_opts::to_string() const
{
  static const char* names[] = {"qam256", "qam64LowSE"};
  return convert_enum_idx(names, 2, value, "pdsch_cfg_s::mcs_table_dci_1_2_r16_e_");
}
uint16_t pdsch_cfg_s::mcs_table_dci_1_2_r16_opts::to_number() const
{
  static const uint16_t numbers[] = {256, 64};
  return map_enum_number(numbers, 2, value, "pdsch_cfg_s::mcs_table_dci_1_2_r16_e_");
}

void pdsch_cfg_s::prb_bundling_type_dci_1_2_r16_c_::destroy_()
{
  switch (type_) {
    case types::static_bundling_r16:
      c.destroy<static_bundling_r16_s_>();
      break;
    case types::dyn_bundling_r16:
      c.destroy<dyn_bundling_r16_s_>();
      break;
    default:
      break;
  }
}
void pdsch_cfg_s::prb_bundling_type_dci_1_2_r16_c_::set(types::options e)
{
  destroy_();
  type_ = e;
  switch (type_) {
    case types::static_bundling_r16:
      c.init<static_bundling_r16_s_>();
      break;
    case types::dyn_bundling_r16:
      c.init<dyn_bundling_r16_s_>();
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "pdsch_cfg_s::prb_bundling_type_dci_1_2_r16_c_");
  }
}
pdsch_cfg_s::prb_bundling_type_dci_1_2_r16_c_::prb_bundling_type_dci_1_2_r16_c_(
    const pdsch_cfg_s::prb_bundling_type_dci_1_2_r16_c_& other)
{
  type_ = other.type();
  switch (type_) {
    case types::static_bundling_r16:
      c.init(other.c.get<static_bundling_r16_s_>());
      break;
    case types::dyn_bundling_r16:
      c.init(other.c.get<dyn_bundling_r16_s_>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "pdsch_cfg_s::prb_bundling_type_dci_1_2_r16_c_");
  }
}
pdsch_cfg_s::prb_bundling_type_dci_1_2_r16_c_&
pdsch_cfg_s::prb_bundling_type_dci_1_2_r16_c_::operator=(const pdsch_cfg_s::prb_bundling_type_dci_1_2_r16_c_& other)
{
  if (this == &other) {
    return *this;
  }
  set(other.type());
  switch (type_) {
    case types::static_bundling_r16:
      c.set(other.c.get<static_bundling_r16_s_>());
      break;
    case types::dyn_bundling_r16:
      c.set(other.c.get<dyn_bundling_r16_s_>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "pdsch_cfg_s::prb_bundling_type_dci_1_2_r16_c_");
  }

  return *this;
}
pdsch_cfg_s::prb_bundling_type_dci_1_2_r16_c_::static_bundling_r16_s_&
pdsch_cfg_s::prb_bundling_type_dci_1_2_r16_c_::set_static_bundling_r16()
{
  set(types::static_bundling_r16);
  return c.get<static_bundling_r16_s_>();
}
pdsch_cfg_s::prb_bundling_type_dci_1_2_r16_c_::dyn_bundling_r16_s_&
pdsch_cfg_s::prb_bundling_type_dci_1_2_r16_c_::set_dyn_bundling_r16()
{
  set(types::dyn_bundling_r16);
  return c.get<dyn_bundling_r16_s_>();
}
void pdsch_cfg_s::prb_bundling_type_dci_1_2_r16_c_::to_json(json_writer& j) const
{
  j.start_obj();
  switch (type_) {
    case types::static_bundling_r16:
      j.write_fieldname("staticBundling-r16");
      j.start_obj();
      if (c.get<static_bundling_r16_s_>().bundle_size_r16_present) {
        j.write_str("bundleSize-r16", c.get<static_bundling_r16_s_>().bundle_size_r16.to_string());
      }
      j.end_obj();
      break;
    case types::dyn_bundling_r16:
      j.write_fieldname("dynamicBundling-r16");
      j.start_obj();
      if (c.get<dyn_bundling_r16_s_>().bundle_size_set1_r16_present) {
        j.write_str("bundleSizeSet1-r16", c.get<dyn_bundling_r16_s_>().bundle_size_set1_r16.to_string());
      }
      if (c.get<dyn_bundling_r16_s_>().bundle_size_set2_r16_present) {
        j.write_str("bundleSizeSet2-r16", c.get<dyn_bundling_r16_s_>().bundle_size_set2_r16.to_string());
      }
      j.end_obj();
      break;
    default:
      log_invalid_choice_id(type_, "pdsch_cfg_s::prb_bundling_type_dci_1_2_r16_c_");
  }
  j.end_obj();
}
SRSASN_CODE pdsch_cfg_s::prb_bundling_type_dci_1_2_r16_c_::pack(bit_ref& bref) const
{
  type_.pack(bref);
  switch (type_) {
    case types::static_bundling_r16:
      HANDLE_CODE(bref.pack(c.get<static_bundling_r16_s_>().bundle_size_r16_present, 1));
      if (c.get<static_bundling_r16_s_>().bundle_size_r16_present) {
        HANDLE_CODE(c.get<static_bundling_r16_s_>().bundle_size_r16.pack(bref));
      }
      break;
    case types::dyn_bundling_r16:
      HANDLE_CODE(bref.pack(c.get<dyn_bundling_r16_s_>().bundle_size_set1_r16_present, 1));
      HANDLE_CODE(bref.pack(c.get<dyn_bundling_r16_s_>().bundle_size_set2_r16_present, 1));
      if (c.get<dyn_bundling_r16_s_>().bundle_size_set1_r16_present) {
        HANDLE_CODE(c.get<dyn_bundling_r16_s_>().bundle_size_set1_r16.pack(bref));
      }
      if (c.get<dyn_bundling_r16_s_>().bundle_size_set2_r16_present) {
        HANDLE_CODE(c.get<dyn_bundling_r16_s_>().bundle_size_set2_r16.pack(bref));
      }
      break;
    default:
      log_invalid_choice_id(type_, "pdsch_cfg_s::prb_bundling_type_dci_1_2_r16_c_");
      return SRSASN_ERROR_ENCODE_FAIL;
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE pdsch_cfg_s::prb_bundling_type_dci_1_2_r16_c_::unpack(cbit_ref& bref)
{
  types e;
  e.unpack(bref);
  set(e);
  switch (type_) {
    case types::static_bundling_r16:
      HANDLE_CODE(bref.unpack(c.get<static_bundling_r16_s_>().bundle_size_r16_present, 1));
      if (c.get<static_bundling_r16_s_>().bundle_size_r16_present) {
        HANDLE_CODE(c.get<static_bundling_r16_s_>().bundle_size_r16.unpack(bref));
      }
      break;
    case types::dyn_bundling_r16:
      HANDLE_CODE(bref.unpack(c.get<dyn_bundling_r16_s_>().bundle_size_set1_r16_present, 1));
      HANDLE_CODE(bref.unpack(c.get<dyn_bundling_r16_s_>().bundle_size_set2_r16_present, 1));
      if (c.get<dyn_bundling_r16_s_>().bundle_size_set1_r16_present) {
        HANDLE_CODE(c.get<dyn_bundling_r16_s_>().bundle_size_set1_r16.unpack(bref));
      }
      if (c.get<dyn_bundling_r16_s_>().bundle_size_set2_r16_present) {
        HANDLE_CODE(c.get<dyn_bundling_r16_s_>().bundle_size_set2_r16.unpack(bref));
      }
      break;
    default:
      log_invalid_choice_id(type_, "pdsch_cfg_s::prb_bundling_type_dci_1_2_r16_c_");
      return SRSASN_ERROR_DECODE_FAIL;
  }
  return SRSASN_SUCCESS;
}

const char*
pdsch_cfg_s::prb_bundling_type_dci_1_2_r16_c_::static_bundling_r16_s_::bundle_size_r16_opts::to_string() const
{
  static const char* names[] = {"n4", "wideband"};
  return convert_enum_idx(
      names, 2, value, "pdsch_cfg_s::prb_bundling_type_dci_1_2_r16_c_::static_bundling_r16_s_::bundle_size_r16_e_");
}
uint8_t pdsch_cfg_s::prb_bundling_type_dci_1_2_r16_c_::static_bundling_r16_s_::bundle_size_r16_opts::to_number() const
{
  static const uint8_t numbers[] = {4};
  return map_enum_number(
      numbers, 1, value, "pdsch_cfg_s::prb_bundling_type_dci_1_2_r16_c_::static_bundling_r16_s_::bundle_size_r16_e_");
}

const char*
pdsch_cfg_s::prb_bundling_type_dci_1_2_r16_c_::dyn_bundling_r16_s_::bundle_size_set1_r16_opts::to_string() const
{
  static const char* names[] = {"n4", "wideband", "n2-wideband", "n4-wideband"};
  return convert_enum_idx(
      names, 4, value, "pdsch_cfg_s::prb_bundling_type_dci_1_2_r16_c_::dyn_bundling_r16_s_::bundle_size_set1_r16_e_");
}

const char*
pdsch_cfg_s::prb_bundling_type_dci_1_2_r16_c_::dyn_bundling_r16_s_::bundle_size_set2_r16_opts::to_string() const
{
  static const char* names[] = {"n4", "wideband"};
  return convert_enum_idx(
      names, 2, value, "pdsch_cfg_s::prb_bundling_type_dci_1_2_r16_c_::dyn_bundling_r16_s_::bundle_size_set2_r16_e_");
}
uint8_t pdsch_cfg_s::prb_bundling_type_dci_1_2_r16_c_::dyn_bundling_r16_s_::bundle_size_set2_r16_opts::to_number() const
{
  static const uint8_t numbers[] = {4};
  return map_enum_number(
      numbers, 1, value, "pdsch_cfg_s::prb_bundling_type_dci_1_2_r16_c_::dyn_bundling_r16_s_::bundle_size_set2_r16_e_");
}

const char* pdsch_cfg_s::prb_bundling_type_dci_1_2_r16_c_::types_opts::to_string() const
{
  static const char* names[] = {"staticBundling-r16", "dynamicBundling-r16"};
  return convert_enum_idx(names, 2, value, "pdsch_cfg_s::prb_bundling_type_dci_1_2_r16_c_::types");
}

const char* pdsch_cfg_s::res_alloc_type1_granularity_dci_1_2_r16_opts::to_string() const
{
  static const char* names[] = {"n2", "n4", "n8", "n16"};
  return convert_enum_idx(names, 4, value, "pdsch_cfg_s::res_alloc_type1_granularity_dci_1_2_r16_e_");
}
uint8_t pdsch_cfg_s::res_alloc_type1_granularity_dci_1_2_r16_opts::to_number() const
{
  static const uint8_t numbers[] = {2, 4, 8, 16};
  return map_enum_number(numbers, 4, value, "pdsch_cfg_s::res_alloc_type1_granularity_dci_1_2_r16_e_");
}

const char* pdsch_cfg_s::vrb_to_prb_interleaver_dci_1_2_r16_opts::to_string() const
{
  static const char* names[] = {"n2", "n4"};
  return convert_enum_idx(names, 2, value, "pdsch_cfg_s::vrb_to_prb_interleaver_dci_1_2_r16_e_");
}
uint8_t pdsch_cfg_s::vrb_to_prb_interleaver_dci_1_2_r16_opts::to_number() const
{
  static const uint8_t numbers[] = {2, 4};
  return map_enum_number(numbers, 2, value, "pdsch_cfg_s::vrb_to_prb_interleaver_dci_1_2_r16_e_");
}

const char* pdsch_cfg_s::res_alloc_dci_1_2_r16_opts::to_string() const
{
  static const char* names[] = {"resourceAllocationType0", "resourceAllocationType1", "dynamicSwitch"};
  return convert_enum_idx(names, 3, value, "pdsch_cfg_s::res_alloc_dci_1_2_r16_e_");
}
uint8_t pdsch_cfg_s::res_alloc_dci_1_2_r16_opts::to_number() const
{
  static const uint8_t numbers[] = {0, 1};
  return map_enum_number(numbers, 2, value, "pdsch_cfg_s::res_alloc_dci_1_2_r16_e_");
}

void pdsch_cfg_s::dl_or_joint_tci_state_list_r17_c_::destroy_()
{
  switch (type_) {
    case types::explicitlist:
      c.destroy<explicitlist_s_>();
      break;
    case types::unified_tci_state_ref_r17:
      c.destroy<serving_cell_and_bwp_id_r17_s>();
      break;
    default:
      break;
  }
}
void pdsch_cfg_s::dl_or_joint_tci_state_list_r17_c_::set(types::options e)
{
  destroy_();
  type_ = e;
  switch (type_) {
    case types::explicitlist:
      c.init<explicitlist_s_>();
      break;
    case types::unified_tci_state_ref_r17:
      c.init<serving_cell_and_bwp_id_r17_s>();
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "pdsch_cfg_s::dl_or_joint_tci_state_list_r17_c_");
  }
}
pdsch_cfg_s::dl_or_joint_tci_state_list_r17_c_::dl_or_joint_tci_state_list_r17_c_(
    const pdsch_cfg_s::dl_or_joint_tci_state_list_r17_c_& other)
{
  type_ = other.type();
  switch (type_) {
    case types::explicitlist:
      c.init(other.c.get<explicitlist_s_>());
      break;
    case types::unified_tci_state_ref_r17:
      c.init(other.c.get<serving_cell_and_bwp_id_r17_s>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "pdsch_cfg_s::dl_or_joint_tci_state_list_r17_c_");
  }
}
pdsch_cfg_s::dl_or_joint_tci_state_list_r17_c_&
pdsch_cfg_s::dl_or_joint_tci_state_list_r17_c_::operator=(const pdsch_cfg_s::dl_or_joint_tci_state_list_r17_c_& other)
{
  if (this == &other) {
    return *this;
  }
  set(other.type());
  switch (type_) {
    case types::explicitlist:
      c.set(other.c.get<explicitlist_s_>());
      break;
    case types::unified_tci_state_ref_r17:
      c.set(other.c.get<serving_cell_and_bwp_id_r17_s>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "pdsch_cfg_s::dl_or_joint_tci_state_list_r17_c_");
  }

  return *this;
}
pdsch_cfg_s::dl_or_joint_tci_state_list_r17_c_::explicitlist_s_&
pdsch_cfg_s::dl_or_joint_tci_state_list_r17_c_::set_explicitlist()
{
  set(types::explicitlist);
  return c.get<explicitlist_s_>();
}
serving_cell_and_bwp_id_r17_s& pdsch_cfg_s::dl_or_joint_tci_state_list_r17_c_::set_unified_tci_state_ref_r17()
{
  set(types::unified_tci_state_ref_r17);
  return c.get<serving_cell_and_bwp_id_r17_s>();
}
void pdsch_cfg_s::dl_or_joint_tci_state_list_r17_c_::to_json(json_writer& j) const
{
  j.start_obj();
  switch (type_) {
    case types::explicitlist:
      j.write_fieldname("explicitlist");
      j.start_obj();
      if (c.get<explicitlist_s_>().dl_or_joint_tci_state_to_add_mod_list_r17.size() > 0) {
        j.start_array("dl-OrJointTCI-StateToAddModList-r17");
        for (const auto& e1 : c.get<explicitlist_s_>().dl_or_joint_tci_state_to_add_mod_list_r17) {
          e1.to_json(j);
        }
        j.end_array();
      }
      if (c.get<explicitlist_s_>().dl_or_joint_tci_state_to_release_list_r17.size() > 0) {
        j.start_array("dl-OrJointTCI-StateToReleaseList-r17");
        for (const auto& e1 : c.get<explicitlist_s_>().dl_or_joint_tci_state_to_release_list_r17) {
          j.write_int(e1);
        }
        j.end_array();
      }
      j.end_obj();
      break;
    case types::unified_tci_state_ref_r17:
      j.write_fieldname("unifiedTCI-StateRef-r17");
      c.get<serving_cell_and_bwp_id_r17_s>().to_json(j);
      break;
    default:
      log_invalid_choice_id(type_, "pdsch_cfg_s::dl_or_joint_tci_state_list_r17_c_");
  }
  j.end_obj();
}
SRSASN_CODE pdsch_cfg_s::dl_or_joint_tci_state_list_r17_c_::pack(bit_ref& bref) const
{
  type_.pack(bref);
  switch (type_) {
    case types::explicitlist:
      HANDLE_CODE(bref.pack(c.get<explicitlist_s_>().dl_or_joint_tci_state_to_add_mod_list_r17.size() > 0, 1));
      HANDLE_CODE(bref.pack(c.get<explicitlist_s_>().dl_or_joint_tci_state_to_release_list_r17.size() > 0, 1));
      if (c.get<explicitlist_s_>().dl_or_joint_tci_state_to_add_mod_list_r17.size() > 0) {
        HANDLE_CODE(pack_dyn_seq_of(bref, c.get<explicitlist_s_>().dl_or_joint_tci_state_to_add_mod_list_r17, 1, 128));
      }
      if (c.get<explicitlist_s_>().dl_or_joint_tci_state_to_release_list_r17.size() > 0) {
        HANDLE_CODE(pack_dyn_seq_of(bref,
                                    c.get<explicitlist_s_>().dl_or_joint_tci_state_to_release_list_r17,
                                    1,
                                    128,
                                    integer_packer<uint8_t>(0, 127)));
      }
      break;
    case types::unified_tci_state_ref_r17:
      HANDLE_CODE(c.get<serving_cell_and_bwp_id_r17_s>().pack(bref));
      break;
    default:
      log_invalid_choice_id(type_, "pdsch_cfg_s::dl_or_joint_tci_state_list_r17_c_");
      return SRSASN_ERROR_ENCODE_FAIL;
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE pdsch_cfg_s::dl_or_joint_tci_state_list_r17_c_::unpack(cbit_ref& bref)
{
  types e;
  e.unpack(bref);
  set(e);
  switch (type_) {
    case types::explicitlist:
      bool dl_or_joint_tci_state_to_add_mod_list_r17_present;
      HANDLE_CODE(bref.unpack(dl_or_joint_tci_state_to_add_mod_list_r17_present, 1));
      bool dl_or_joint_tci_state_to_release_list_r17_present;
      HANDLE_CODE(bref.unpack(dl_or_joint_tci_state_to_release_list_r17_present, 1));
      if (dl_or_joint_tci_state_to_add_mod_list_r17_present) {
        HANDLE_CODE(
            unpack_dyn_seq_of(c.get<explicitlist_s_>().dl_or_joint_tci_state_to_add_mod_list_r17, bref, 1, 128));
      }
      if (dl_or_joint_tci_state_to_release_list_r17_present) {
        HANDLE_CODE(unpack_dyn_seq_of(c.get<explicitlist_s_>().dl_or_joint_tci_state_to_release_list_r17,
                                      bref,
                                      1,
                                      128,
                                      integer_packer<uint8_t>(0, 127)));
      }
      break;
    case types::unified_tci_state_ref_r17:
      HANDLE_CODE(c.get<serving_cell_and_bwp_id_r17_s>().unpack(bref));
      break;
    default:
      log_invalid_choice_id(type_, "pdsch_cfg_s::dl_or_joint_tci_state_list_r17_c_");
      return SRSASN_ERROR_DECODE_FAIL;
  }
  return SRSASN_SUCCESS;
}

const char* pdsch_cfg_s::dl_or_joint_tci_state_list_r17_c_::types_opts::to_string() const
{
  static const char* names[] = {"explicitlist", "unifiedTCI-StateRef-r17"};
  return convert_enum_idx(names, 2, value, "pdsch_cfg_s::dl_or_joint_tci_state_list_r17_c_::types");
}

const char* pdsch_cfg_s::beam_app_time_r17_opts::to_string() const
{
  static const char* names[] = {"n1",
                                "n2",
                                "n4",
                                "n7",
                                "n14",
                                "n28",
                                "n42",
                                "n56",
                                "n70",
                                "n84",
                                "n98",
                                "n112",
                                "n224",
                                "n336",
                                "spare2",
                                "spare1"};
  return convert_enum_idx(names, 16, value, "pdsch_cfg_s::beam_app_time_r17_e_");
}
uint16_t pdsch_cfg_s::beam_app_time_r17_opts::to_number() const
{
  static const uint16_t numbers[] = {1, 2, 4, 7, 14, 28, 42, 56, 70, 84, 98, 112, 224, 336};
  return map_enum_number(numbers, 14, value, "pdsch_cfg_s::beam_app_time_r17_e_");
}

const char* pdsch_cfg_s::xoverhead_multicast_r17_opts::to_string() const
{
  static const char* names[] = {"xOh6", "xOh12", "xOh18"};
  return convert_enum_idx(names, 3, value, "pdsch_cfg_s::xoverhead_multicast_r17_e_");
}
uint8_t pdsch_cfg_s::xoverhead_multicast_r17_opts::to_number() const
{
  static const uint8_t numbers[] = {6, 12, 18};
  return map_enum_number(numbers, 3, value, "pdsch_cfg_s::xoverhead_multicast_r17_e_");
}

// RadioLinkMonitoringRS ::= SEQUENCE
SRSASN_CODE radio_link_monitoring_rs_s::pack(bit_ref& bref) const
{
  bref.pack(ext, 1);
  HANDLE_CODE(pack_integer(bref, radio_link_monitoring_rs_id, (uint8_t)0u, (uint8_t)9u));
  HANDLE_CODE(purpose.pack(bref));
  HANDLE_CODE(detection_res.pack(bref));

  return SRSASN_SUCCESS;
}
SRSASN_CODE radio_link_monitoring_rs_s::unpack(cbit_ref& bref)
{
  bref.unpack(ext, 1);
  HANDLE_CODE(unpack_integer(radio_link_monitoring_rs_id, bref, (uint8_t)0u, (uint8_t)9u));
  HANDLE_CODE(purpose.unpack(bref));
  HANDLE_CODE(detection_res.unpack(bref));

  return SRSASN_SUCCESS;
}
void radio_link_monitoring_rs_s::to_json(json_writer& j) const
{
  j.start_obj();
  j.write_int("radioLinkMonitoringRS-Id", radio_link_monitoring_rs_id);
  j.write_str("purpose", purpose.to_string());
  j.write_fieldname("detectionResource");
  detection_res.to_json(j);
  j.end_obj();
}

const char* radio_link_monitoring_rs_s::purpose_opts::to_string() const
{
  static const char* names[] = {"beamFailure", "rlf", "both"};
  return convert_enum_idx(names, 3, value, "radio_link_monitoring_rs_s::purpose_e_");
}

void radio_link_monitoring_rs_s::detection_res_c_::destroy_() {}
void radio_link_monitoring_rs_s::detection_res_c_::set(types::options e)
{
  destroy_();
  type_ = e;
}
radio_link_monitoring_rs_s::detection_res_c_::detection_res_c_(
    const radio_link_monitoring_rs_s::detection_res_c_& other)
{
  type_ = other.type();
  switch (type_) {
    case types::ssb_idx:
      c.init(other.c.get<uint8_t>());
      break;
    case types::csi_rs_idx:
      c.init(other.c.get<uint8_t>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "radio_link_monitoring_rs_s::detection_res_c_");
  }
}
radio_link_monitoring_rs_s::detection_res_c_&
radio_link_monitoring_rs_s::detection_res_c_::operator=(const radio_link_monitoring_rs_s::detection_res_c_& other)
{
  if (this == &other) {
    return *this;
  }
  set(other.type());
  switch (type_) {
    case types::ssb_idx:
      c.set(other.c.get<uint8_t>());
      break;
    case types::csi_rs_idx:
      c.set(other.c.get<uint8_t>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "radio_link_monitoring_rs_s::detection_res_c_");
  }

  return *this;
}
uint8_t& radio_link_monitoring_rs_s::detection_res_c_::set_ssb_idx()
{
  set(types::ssb_idx);
  return c.get<uint8_t>();
}
uint8_t& radio_link_monitoring_rs_s::detection_res_c_::set_csi_rs_idx()
{
  set(types::csi_rs_idx);
  return c.get<uint8_t>();
}
void radio_link_monitoring_rs_s::detection_res_c_::to_json(json_writer& j) const
{
  j.start_obj();
  switch (type_) {
    case types::ssb_idx:
      j.write_int("ssb-Index", c.get<uint8_t>());
      break;
    case types::csi_rs_idx:
      j.write_int("csi-RS-Index", c.get<uint8_t>());
      break;
    default:
      log_invalid_choice_id(type_, "radio_link_monitoring_rs_s::detection_res_c_");
  }
  j.end_obj();
}
SRSASN_CODE radio_link_monitoring_rs_s::detection_res_c_::pack(bit_ref& bref) const
{
  type_.pack(bref);
  switch (type_) {
    case types::ssb_idx:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)63u));
      break;
    case types::csi_rs_idx:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)191u));
      break;
    default:
      log_invalid_choice_id(type_, "radio_link_monitoring_rs_s::detection_res_c_");
      return SRSASN_ERROR_ENCODE_FAIL;
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE radio_link_monitoring_rs_s::detection_res_c_::unpack(cbit_ref& bref)
{
  types e;
  e.unpack(bref);
  set(e);
  switch (type_) {
    case types::ssb_idx:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)63u));
      break;
    case types::csi_rs_idx:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)191u));
      break;
    default:
      log_invalid_choice_id(type_, "radio_link_monitoring_rs_s::detection_res_c_");
      return SRSASN_ERROR_DECODE_FAIL;
  }
  return SRSASN_SUCCESS;
}

const char* radio_link_monitoring_rs_s::detection_res_c_::types_opts::to_string() const
{
  static const char* names[] = {"ssb-Index", "csi-RS-Index"};
  return convert_enum_idx(names, 2, value, "radio_link_monitoring_rs_s::detection_res_c_::types");
}

// BeamFailureRecoveryRSConfig-r16 ::= SEQUENCE
SRSASN_CODE beam_fail_recovery_rs_cfg_r16_s::pack(bit_ref& bref) const
{
  bref.pack(ext, 1);
  HANDLE_CODE(bref.pack(rsrp_thres_bfr_r16_present, 1));
  HANDLE_CODE(bref.pack(candidate_beam_rs_list_r16.size() > 0, 1));

  if (rsrp_thres_bfr_r16_present) {
    HANDLE_CODE(pack_integer(bref, rsrp_thres_bfr_r16, (uint8_t)0u, (uint8_t)127u));
  }
  if (candidate_beam_rs_list_r16.size() > 0) {
    HANDLE_CODE(pack_dyn_seq_of(bref, candidate_beam_rs_list_r16, 1, 64));
  }

  if (ext) {
    ext_groups_packer_guard group_flags;
    group_flags[0] |= candidate_beam_rs_list2_r17.is_present();
    group_flags.pack(bref);

    if (group_flags[0]) {
      varlength_field_pack_guard varlen_scope(bref, false);

      HANDLE_CODE(bref.pack(candidate_beam_rs_list2_r17.is_present(), 1));
      if (candidate_beam_rs_list2_r17.is_present()) {
        HANDLE_CODE(pack_dyn_seq_of(bref, *candidate_beam_rs_list2_r17, 1, 64));
      }
    }
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE beam_fail_recovery_rs_cfg_r16_s::unpack(cbit_ref& bref)
{
  bref.unpack(ext, 1);
  HANDLE_CODE(bref.unpack(rsrp_thres_bfr_r16_present, 1));
  bool candidate_beam_rs_list_r16_present;
  HANDLE_CODE(bref.unpack(candidate_beam_rs_list_r16_present, 1));

  if (rsrp_thres_bfr_r16_present) {
    HANDLE_CODE(unpack_integer(rsrp_thres_bfr_r16, bref, (uint8_t)0u, (uint8_t)127u));
  }
  if (candidate_beam_rs_list_r16_present) {
    HANDLE_CODE(unpack_dyn_seq_of(candidate_beam_rs_list_r16, bref, 1, 64));
  }

  if (ext) {
    ext_groups_unpacker_guard group_flags(1);
    group_flags.unpack(bref);

    if (group_flags[0]) {
      varlength_field_unpack_guard varlen_scope(bref, false);

      unpack_presence_flag(candidate_beam_rs_list2_r17, bref);
      if (candidate_beam_rs_list2_r17.is_present()) {
        HANDLE_CODE(unpack_dyn_seq_of(*candidate_beam_rs_list2_r17, bref, 1, 64));
      }
    }
  }
  return SRSASN_SUCCESS;
}
void beam_fail_recovery_rs_cfg_r16_s::to_json(json_writer& j) const
{
  j.start_obj();
  if (rsrp_thres_bfr_r16_present) {
    j.write_int("rsrp-ThresholdBFR-r16", rsrp_thres_bfr_r16);
  }
  if (candidate_beam_rs_list_r16.size() > 0) {
    j.start_array("candidateBeamRS-List-r16");
    for (const auto& e1 : candidate_beam_rs_list_r16) {
      e1.to_json(j);
    }
    j.end_array();
  }
  if (ext) {
    if (candidate_beam_rs_list2_r17.is_present()) {
      j.start_array("candidateBeamRS-List2-r17");
      for (const auto& e1 : *candidate_beam_rs_list2_r17) {
        e1.to_json(j);
      }
      j.end_array();
    }
  }
  j.end_obj();
}

// CFR-ConfigMulticast-r17 ::= SEQUENCE
SRSASN_CODE cfr_cfg_multicast_r17_s::pack(bit_ref& bref) const
{
  HANDLE_CODE(bref.pack(location_and_bw_multicast_r17_present, 1));
  HANDLE_CODE(bref.pack(pdcch_cfg_multicast_r17_present, 1));
  HANDLE_CODE(bref.pack(pdsch_cfg_multicast_r17_present, 1));
  HANDLE_CODE(bref.pack(sps_cfg_multicast_to_add_mod_list_r17.size() > 0, 1));
  HANDLE_CODE(bref.pack(sps_cfg_multicast_to_release_list_r17.size() > 0, 1));

  if (location_and_bw_multicast_r17_present) {
    HANDLE_CODE(pack_integer(bref, location_and_bw_multicast_r17, (uint16_t)0u, (uint16_t)37949u));
  }
  if (pdcch_cfg_multicast_r17_present) {
    HANDLE_CODE(pdcch_cfg_multicast_r17.pack(bref));
  }
  if (pdsch_cfg_multicast_r17_present) {
    HANDLE_CODE(pdsch_cfg_multicast_r17.pack(bref));
  }
  if (sps_cfg_multicast_to_add_mod_list_r17.size() > 0) {
    HANDLE_CODE(pack_dyn_seq_of(bref, sps_cfg_multicast_to_add_mod_list_r17, 1, 8));
  }
  if (sps_cfg_multicast_to_release_list_r17.size() > 0) {
    HANDLE_CODE(pack_dyn_seq_of(bref, sps_cfg_multicast_to_release_list_r17, 1, 8, integer_packer<uint8_t>(0, 7)));
  }

  return SRSASN_SUCCESS;
}
SRSASN_CODE cfr_cfg_multicast_r17_s::unpack(cbit_ref& bref)
{
  HANDLE_CODE(bref.unpack(location_and_bw_multicast_r17_present, 1));
  HANDLE_CODE(bref.unpack(pdcch_cfg_multicast_r17_present, 1));
  HANDLE_CODE(bref.unpack(pdsch_cfg_multicast_r17_present, 1));
  bool sps_cfg_multicast_to_add_mod_list_r17_present;
  HANDLE_CODE(bref.unpack(sps_cfg_multicast_to_add_mod_list_r17_present, 1));
  bool sps_cfg_multicast_to_release_list_r17_present;
  HANDLE_CODE(bref.unpack(sps_cfg_multicast_to_release_list_r17_present, 1));

  if (location_and_bw_multicast_r17_present) {
    HANDLE_CODE(unpack_integer(location_and_bw_multicast_r17, bref, (uint16_t)0u, (uint16_t)37949u));
  }
  if (pdcch_cfg_multicast_r17_present) {
    HANDLE_CODE(pdcch_cfg_multicast_r17.unpack(bref));
  }
  if (pdsch_cfg_multicast_r17_present) {
    HANDLE_CODE(pdsch_cfg_multicast_r17.unpack(bref));
  }
  if (sps_cfg_multicast_to_add_mod_list_r17_present) {
    HANDLE_CODE(unpack_dyn_seq_of(sps_cfg_multicast_to_add_mod_list_r17, bref, 1, 8));
  }
  if (sps_cfg_multicast_to_release_list_r17_present) {
    HANDLE_CODE(unpack_dyn_seq_of(sps_cfg_multicast_to_release_list_r17, bref, 1, 8, integer_packer<uint8_t>(0, 7)));
  }

  return SRSASN_SUCCESS;
}
void cfr_cfg_multicast_r17_s::to_json(json_writer& j) const
{
  j.start_obj();
  if (location_and_bw_multicast_r17_present) {
    j.write_int("locationAndBandwidthMulticast-r17", location_and_bw_multicast_r17);
  }
  if (pdcch_cfg_multicast_r17_present) {
    j.write_fieldname("pdcch-ConfigMulticast-r17");
    pdcch_cfg_multicast_r17.to_json(j);
  }
  if (pdsch_cfg_multicast_r17_present) {
    j.write_fieldname("pdsch-ConfigMulticast-r17");
    pdsch_cfg_multicast_r17.to_json(j);
  }
  if (sps_cfg_multicast_to_add_mod_list_r17.size() > 0) {
    j.start_array("sps-ConfigMulticastToAddModList-r17");
    for (const auto& e1 : sps_cfg_multicast_to_add_mod_list_r17) {
      e1.to_json(j);
    }
    j.end_array();
  }
  if (sps_cfg_multicast_to_release_list_r17.size() > 0) {
    j.start_array("sps-ConfigMulticastToReleaseList-r17");
    for (const auto& e1 : sps_cfg_multicast_to_release_list_r17) {
      j.write_int(e1);
    }
    j.end_array();
  }
  j.end_obj();
}

// RadioLinkMonitoringConfig ::= SEQUENCE
SRSASN_CODE radio_link_monitoring_cfg_s::pack(bit_ref& bref) const
{
  bref.pack(ext, 1);
  HANDLE_CODE(bref.pack(fail_detection_res_to_add_mod_list.size() > 0, 1));
  HANDLE_CODE(bref.pack(fail_detection_res_to_release_list.size() > 0, 1));
  HANDLE_CODE(bref.pack(beam_fail_instance_max_count_present, 1));
  HANDLE_CODE(bref.pack(beam_fail_detection_timer_present, 1));

  if (fail_detection_res_to_add_mod_list.size() > 0) {
    HANDLE_CODE(pack_dyn_seq_of(bref, fail_detection_res_to_add_mod_list, 1, 10));
  }
  if (fail_detection_res_to_release_list.size() > 0) {
    HANDLE_CODE(pack_dyn_seq_of(bref, fail_detection_res_to_release_list, 1, 10, integer_packer<uint8_t>(0, 9)));
  }
  if (beam_fail_instance_max_count_present) {
    HANDLE_CODE(beam_fail_instance_max_count.pack(bref));
  }
  if (beam_fail_detection_timer_present) {
    HANDLE_CODE(beam_fail_detection_timer.pack(bref));
  }

  if (ext) {
    ext_groups_packer_guard group_flags;
    group_flags[0] |= beam_fail_r17.is_present();
    group_flags.pack(bref);

    if (group_flags[0]) {
      varlength_field_pack_guard varlen_scope(bref, false);

      HANDLE_CODE(bref.pack(beam_fail_r17.is_present(), 1));
      if (beam_fail_r17.is_present()) {
        HANDLE_CODE(beam_fail_r17->pack(bref));
      }
    }
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE radio_link_monitoring_cfg_s::unpack(cbit_ref& bref)
{
  bref.unpack(ext, 1);
  bool fail_detection_res_to_add_mod_list_present;
  HANDLE_CODE(bref.unpack(fail_detection_res_to_add_mod_list_present, 1));
  bool fail_detection_res_to_release_list_present;
  HANDLE_CODE(bref.unpack(fail_detection_res_to_release_list_present, 1));
  HANDLE_CODE(bref.unpack(beam_fail_instance_max_count_present, 1));
  HANDLE_CODE(bref.unpack(beam_fail_detection_timer_present, 1));

  if (fail_detection_res_to_add_mod_list_present) {
    HANDLE_CODE(unpack_dyn_seq_of(fail_detection_res_to_add_mod_list, bref, 1, 10));
  }
  if (fail_detection_res_to_release_list_present) {
    HANDLE_CODE(unpack_dyn_seq_of(fail_detection_res_to_release_list, bref, 1, 10, integer_packer<uint8_t>(0, 9)));
  }
  if (beam_fail_instance_max_count_present) {
    HANDLE_CODE(beam_fail_instance_max_count.unpack(bref));
  }
  if (beam_fail_detection_timer_present) {
    HANDLE_CODE(beam_fail_detection_timer.unpack(bref));
  }

  if (ext) {
    ext_groups_unpacker_guard group_flags(1);
    group_flags.unpack(bref);

    if (group_flags[0]) {
      varlength_field_unpack_guard varlen_scope(bref, false);

      unpack_presence_flag(beam_fail_r17, bref);
      if (beam_fail_r17.is_present()) {
        HANDLE_CODE(beam_fail_r17->unpack(bref));
      }
    }
  }
  return SRSASN_SUCCESS;
}
void radio_link_monitoring_cfg_s::to_json(json_writer& j) const
{
  j.start_obj();
  if (fail_detection_res_to_add_mod_list.size() > 0) {
    j.start_array("failureDetectionResourcesToAddModList");
    for (const auto& e1 : fail_detection_res_to_add_mod_list) {
      e1.to_json(j);
    }
    j.end_array();
  }
  if (fail_detection_res_to_release_list.size() > 0) {
    j.start_array("failureDetectionResourcesToReleaseList");
    for (const auto& e1 : fail_detection_res_to_release_list) {
      j.write_int(e1);
    }
    j.end_array();
  }
  if (beam_fail_instance_max_count_present) {
    j.write_str("beamFailureInstanceMaxCount", beam_fail_instance_max_count.to_string());
  }
  if (beam_fail_detection_timer_present) {
    j.write_str("beamFailureDetectionTimer", beam_fail_detection_timer.to_string());
  }
  if (ext) {
    if (beam_fail_r17.is_present()) {
      j.write_fieldname("beamFailure-r17");
      beam_fail_r17->to_json(j);
    }
  }
  j.end_obj();
}

const char* radio_link_monitoring_cfg_s::beam_fail_instance_max_count_opts::to_string() const
{
  static const char* names[] = {"n1", "n2", "n3", "n4", "n5", "n6", "n8", "n10"};
  return convert_enum_idx(names, 8, value, "radio_link_monitoring_cfg_s::beam_fail_instance_max_count_e_");
}
uint8_t radio_link_monitoring_cfg_s::beam_fail_instance_max_count_opts::to_number() const
{
  static const uint8_t numbers[] = {1, 2, 3, 4, 5, 6, 8, 10};
  return map_enum_number(numbers, 8, value, "radio_link_monitoring_cfg_s::beam_fail_instance_max_count_e_");
}

const char* radio_link_monitoring_cfg_s::beam_fail_detection_timer_opts::to_string() const
{
  static const char* names[] = {"pbfd1", "pbfd2", "pbfd3", "pbfd4", "pbfd5", "pbfd6", "pbfd8", "pbfd10"};
  return convert_enum_idx(names, 8, value, "radio_link_monitoring_cfg_s::beam_fail_detection_timer_e_");
}
uint8_t radio_link_monitoring_cfg_s::beam_fail_detection_timer_opts::to_number() const
{
  static const uint8_t numbers[] = {1, 2, 3, 4, 5, 6, 8, 10};
  return map_enum_number(numbers, 8, value, "radio_link_monitoring_cfg_s::beam_fail_detection_timer_e_");
}

// BWP-DownlinkDedicated ::= SEQUENCE
SRSASN_CODE bwp_dl_ded_s::pack(bit_ref& bref) const
{
  bref.pack(ext, 1);
  HANDLE_CODE(bref.pack(pdcch_cfg_present, 1));
  HANDLE_CODE(bref.pack(pdsch_cfg_present, 1));
  HANDLE_CODE(bref.pack(sps_cfg_present, 1));
  HANDLE_CODE(bref.pack(radio_link_monitoring_cfg_present, 1));

  if (pdcch_cfg_present) {
    HANDLE_CODE(pdcch_cfg.pack(bref));
  }
  if (pdsch_cfg_present) {
    HANDLE_CODE(pdsch_cfg.pack(bref));
  }
  if (sps_cfg_present) {
    HANDLE_CODE(sps_cfg.pack(bref));
  }
  if (radio_link_monitoring_cfg_present) {
    HANDLE_CODE(radio_link_monitoring_cfg.pack(bref));
  }

  if (ext) {
    ext_groups_packer_guard group_flags;
    group_flags[0] |= sps_cfg_to_add_mod_list_r16.is_present();
    group_flags[0] |= sps_cfg_to_release_list_r16.is_present();
    group_flags[0] |= sps_cfg_deactivation_state_list_r16.is_present();
    group_flags[0] |= beam_fail_recovery_scell_cfg_r16.is_present();
    group_flags[0] |= sl_pdcch_cfg_r16.is_present();
    group_flags[0] |= sl_v2x_pdcch_cfg_r16.is_present();
    group_flags[1] |= pre_conf_gap_status_r17_present;
    group_flags[1] |= beam_fail_recovery_sp_cell_cfg_r17.is_present();
    group_flags[1] |= harq_feedback_enablingfor_sp_sactive_r17_present;
    group_flags[1] |= cfr_cfg_multicast_r17.is_present();
    group_flags[1] |= dl_ppw_pre_cfg_to_add_mod_list_r17.is_present();
    group_flags[1] |= dl_ppw_pre_cfg_to_release_list_r17.is_present();
    group_flags[1] |= non_cell_defining_ssb_r17.is_present();
    group_flags[1] |= serving_cell_mo_r17_present;
    group_flags.pack(bref);

    if (group_flags[0]) {
      varlength_field_pack_guard varlen_scope(bref, false);

      HANDLE_CODE(bref.pack(sps_cfg_to_add_mod_list_r16.is_present(), 1));
      HANDLE_CODE(bref.pack(sps_cfg_to_release_list_r16.is_present(), 1));
      HANDLE_CODE(bref.pack(sps_cfg_deactivation_state_list_r16.is_present(), 1));
      HANDLE_CODE(bref.pack(beam_fail_recovery_scell_cfg_r16.is_present(), 1));
      HANDLE_CODE(bref.pack(sl_pdcch_cfg_r16.is_present(), 1));
      HANDLE_CODE(bref.pack(sl_v2x_pdcch_cfg_r16.is_present(), 1));
      if (sps_cfg_to_add_mod_list_r16.is_present()) {
        HANDLE_CODE(pack_dyn_seq_of(bref, *sps_cfg_to_add_mod_list_r16, 1, 8));
      }
      if (sps_cfg_to_release_list_r16.is_present()) {
        HANDLE_CODE(pack_dyn_seq_of(bref, *sps_cfg_to_release_list_r16, 1, 8, integer_packer<uint8_t>(0, 7)));
      }
      if (sps_cfg_deactivation_state_list_r16.is_present()) {
        HANDLE_CODE(pack_dyn_seq_of(bref,
                                    *sps_cfg_deactivation_state_list_r16,
                                    1,
                                    16,
                                    SeqOfPacker<integer_packer<uint8_t>>(1, 8, integer_packer<uint8_t>(0, 7))));
      }
      if (beam_fail_recovery_scell_cfg_r16.is_present()) {
        HANDLE_CODE(beam_fail_recovery_scell_cfg_r16->pack(bref));
      }
      if (sl_pdcch_cfg_r16.is_present()) {
        HANDLE_CODE(sl_pdcch_cfg_r16->pack(bref));
      }
      if (sl_v2x_pdcch_cfg_r16.is_present()) {
        HANDLE_CODE(sl_v2x_pdcch_cfg_r16->pack(bref));
      }
    }
    if (group_flags[1]) {
      varlength_field_pack_guard varlen_scope(bref, false);

      HANDLE_CODE(bref.pack(pre_conf_gap_status_r17_present, 1));
      HANDLE_CODE(bref.pack(beam_fail_recovery_sp_cell_cfg_r17.is_present(), 1));
      HANDLE_CODE(bref.pack(harq_feedback_enablingfor_sp_sactive_r17_present, 1));
      HANDLE_CODE(bref.pack(cfr_cfg_multicast_r17.is_present(), 1));
      HANDLE_CODE(bref.pack(dl_ppw_pre_cfg_to_add_mod_list_r17.is_present(), 1));
      HANDLE_CODE(bref.pack(dl_ppw_pre_cfg_to_release_list_r17.is_present(), 1));
      HANDLE_CODE(bref.pack(non_cell_defining_ssb_r17.is_present(), 1));
      HANDLE_CODE(bref.pack(serving_cell_mo_r17_present, 1));
      if (pre_conf_gap_status_r17_present) {
        HANDLE_CODE(pre_conf_gap_status_r17.pack(bref));
      }
      if (beam_fail_recovery_sp_cell_cfg_r17.is_present()) {
        HANDLE_CODE(beam_fail_recovery_sp_cell_cfg_r17->pack(bref));
      }
      if (harq_feedback_enablingfor_sp_sactive_r17_present) {
        HANDLE_CODE(bref.pack(harq_feedback_enablingfor_sp_sactive_r17, 1));
      }
      if (cfr_cfg_multicast_r17.is_present()) {
        HANDLE_CODE(cfr_cfg_multicast_r17->pack(bref));
      }
      if (dl_ppw_pre_cfg_to_add_mod_list_r17.is_present()) {
        HANDLE_CODE(pack_dyn_seq_of(bref, *dl_ppw_pre_cfg_to_add_mod_list_r17, 1, 4));
      }
      if (dl_ppw_pre_cfg_to_release_list_r17.is_present()) {
        HANDLE_CODE(pack_dyn_seq_of(bref, *dl_ppw_pre_cfg_to_release_list_r17, 1, 4, integer_packer<uint8_t>(0, 15)));
      }
      if (non_cell_defining_ssb_r17.is_present()) {
        HANDLE_CODE(non_cell_defining_ssb_r17->pack(bref));
      }
      if (serving_cell_mo_r17_present) {
        HANDLE_CODE(pack_integer(bref, serving_cell_mo_r17, (uint8_t)1u, (uint8_t)64u));
      }
    }
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE bwp_dl_ded_s::unpack(cbit_ref& bref)
{
  bref.unpack(ext, 1);
  HANDLE_CODE(bref.unpack(pdcch_cfg_present, 1));
  HANDLE_CODE(bref.unpack(pdsch_cfg_present, 1));
  HANDLE_CODE(bref.unpack(sps_cfg_present, 1));
  HANDLE_CODE(bref.unpack(radio_link_monitoring_cfg_present, 1));

  if (pdcch_cfg_present) {
    HANDLE_CODE(pdcch_cfg.unpack(bref));
  }
  if (pdsch_cfg_present) {
    HANDLE_CODE(pdsch_cfg.unpack(bref));
  }
  if (sps_cfg_present) {
    HANDLE_CODE(sps_cfg.unpack(bref));
  }
  if (radio_link_monitoring_cfg_present) {
    HANDLE_CODE(radio_link_monitoring_cfg.unpack(bref));
  }

  if (ext) {
    ext_groups_unpacker_guard group_flags(2);
    group_flags.unpack(bref);

    if (group_flags[0]) {
      varlength_field_unpack_guard varlen_scope(bref, false);

      unpack_presence_flag(sps_cfg_to_add_mod_list_r16, bref);
      unpack_presence_flag(sps_cfg_to_release_list_r16, bref);
      unpack_presence_flag(sps_cfg_deactivation_state_list_r16, bref);
      unpack_presence_flag(beam_fail_recovery_scell_cfg_r16, bref);
      unpack_presence_flag(sl_pdcch_cfg_r16, bref);
      unpack_presence_flag(sl_v2x_pdcch_cfg_r16, bref);
      if (sps_cfg_to_add_mod_list_r16.is_present()) {
        HANDLE_CODE(unpack_dyn_seq_of(*sps_cfg_to_add_mod_list_r16, bref, 1, 8));
      }
      if (sps_cfg_to_release_list_r16.is_present()) {
        HANDLE_CODE(unpack_dyn_seq_of(*sps_cfg_to_release_list_r16, bref, 1, 8, integer_packer<uint8_t>(0, 7)));
      }
      if (sps_cfg_deactivation_state_list_r16.is_present()) {
        HANDLE_CODE(unpack_dyn_seq_of(*sps_cfg_deactivation_state_list_r16,
                                      bref,
                                      1,
                                      16,
                                      SeqOfPacker<integer_packer<uint8_t>>(1, 8, integer_packer<uint8_t>(0, 7))));
      }
      if (beam_fail_recovery_scell_cfg_r16.is_present()) {
        HANDLE_CODE(beam_fail_recovery_scell_cfg_r16->unpack(bref));
      }
      if (sl_pdcch_cfg_r16.is_present()) {
        HANDLE_CODE(sl_pdcch_cfg_r16->unpack(bref));
      }
      if (sl_v2x_pdcch_cfg_r16.is_present()) {
        HANDLE_CODE(sl_v2x_pdcch_cfg_r16->unpack(bref));
      }
    }
    if (group_flags[1]) {
      varlength_field_unpack_guard varlen_scope(bref, false);

      HANDLE_CODE(bref.unpack(pre_conf_gap_status_r17_present, 1));
      unpack_presence_flag(beam_fail_recovery_sp_cell_cfg_r17, bref);
      HANDLE_CODE(bref.unpack(harq_feedback_enablingfor_sp_sactive_r17_present, 1));
      unpack_presence_flag(cfr_cfg_multicast_r17, bref);
      unpack_presence_flag(dl_ppw_pre_cfg_to_add_mod_list_r17, bref);
      unpack_presence_flag(dl_ppw_pre_cfg_to_release_list_r17, bref);
      unpack_presence_flag(non_cell_defining_ssb_r17, bref);
      HANDLE_CODE(bref.unpack(serving_cell_mo_r17_present, 1));
      if (pre_conf_gap_status_r17_present) {
        HANDLE_CODE(pre_conf_gap_status_r17.unpack(bref));
      }
      if (beam_fail_recovery_sp_cell_cfg_r17.is_present()) {
        HANDLE_CODE(beam_fail_recovery_sp_cell_cfg_r17->unpack(bref));
      }
      if (harq_feedback_enablingfor_sp_sactive_r17_present) {
        HANDLE_CODE(bref.unpack(harq_feedback_enablingfor_sp_sactive_r17, 1));
      }
      if (cfr_cfg_multicast_r17.is_present()) {
        HANDLE_CODE(cfr_cfg_multicast_r17->unpack(bref));
      }
      if (dl_ppw_pre_cfg_to_add_mod_list_r17.is_present()) {
        HANDLE_CODE(unpack_dyn_seq_of(*dl_ppw_pre_cfg_to_add_mod_list_r17, bref, 1, 4));
      }
      if (dl_ppw_pre_cfg_to_release_list_r17.is_present()) {
        HANDLE_CODE(unpack_dyn_seq_of(*dl_ppw_pre_cfg_to_release_list_r17, bref, 1, 4, integer_packer<uint8_t>(0, 15)));
      }
      if (non_cell_defining_ssb_r17.is_present()) {
        HANDLE_CODE(non_cell_defining_ssb_r17->unpack(bref));
      }
      if (serving_cell_mo_r17_present) {
        HANDLE_CODE(unpack_integer(serving_cell_mo_r17, bref, (uint8_t)1u, (uint8_t)64u));
      }
    }
  }
  return SRSASN_SUCCESS;
}
void bwp_dl_ded_s::to_json(json_writer& j) const
{
  j.start_obj();
  if (pdcch_cfg_present) {
    j.write_fieldname("pdcch-Config");
    pdcch_cfg.to_json(j);
  }
  if (pdsch_cfg_present) {
    j.write_fieldname("pdsch-Config");
    pdsch_cfg.to_json(j);
  }
  if (sps_cfg_present) {
    j.write_fieldname("sps-Config");
    sps_cfg.to_json(j);
  }
  if (radio_link_monitoring_cfg_present) {
    j.write_fieldname("radioLinkMonitoringConfig");
    radio_link_monitoring_cfg.to_json(j);
  }
  if (ext) {
    if (sps_cfg_to_add_mod_list_r16.is_present()) {
      j.start_array("sps-ConfigToAddModList-r16");
      for (const auto& e1 : *sps_cfg_to_add_mod_list_r16) {
        e1.to_json(j);
      }
      j.end_array();
    }
    if (sps_cfg_to_release_list_r16.is_present()) {
      j.start_array("sps-ConfigToReleaseList-r16");
      for (const auto& e1 : *sps_cfg_to_release_list_r16) {
        j.write_int(e1);
      }
      j.end_array();
    }
    if (sps_cfg_deactivation_state_list_r16.is_present()) {
      j.start_array("sps-ConfigDeactivationStateList-r16");
      for (const auto& e1 : *sps_cfg_deactivation_state_list_r16) {
        j.start_array();
        for (const auto& e2 : e1) {
          j.write_int(e2);
        }
        j.end_array();
      }
      j.end_array();
    }
    if (beam_fail_recovery_scell_cfg_r16.is_present()) {
      j.write_fieldname("beamFailureRecoverySCellConfig-r16");
      beam_fail_recovery_scell_cfg_r16->to_json(j);
    }
    if (sl_pdcch_cfg_r16.is_present()) {
      j.write_fieldname("sl-PDCCH-Config-r16");
      sl_pdcch_cfg_r16->to_json(j);
    }
    if (sl_v2x_pdcch_cfg_r16.is_present()) {
      j.write_fieldname("sl-V2X-PDCCH-Config-r16");
      sl_v2x_pdcch_cfg_r16->to_json(j);
    }
    if (pre_conf_gap_status_r17_present) {
      j.write_str("preConfGapStatus-r17", pre_conf_gap_status_r17.to_string());
    }
    if (beam_fail_recovery_sp_cell_cfg_r17.is_present()) {
      j.write_fieldname("beamFailureRecoverySpCellConfig-r17");
      beam_fail_recovery_sp_cell_cfg_r17->to_json(j);
    }
    if (harq_feedback_enablingfor_sp_sactive_r17_present) {
      j.write_bool("harq-FeedbackEnablingforSPSactive-r17", harq_feedback_enablingfor_sp_sactive_r17);
    }
    if (cfr_cfg_multicast_r17.is_present()) {
      j.write_fieldname("cfr-ConfigMulticast-r17");
      cfr_cfg_multicast_r17->to_json(j);
    }
    if (dl_ppw_pre_cfg_to_add_mod_list_r17.is_present()) {
      j.start_array("dl-PPW-PreConfigToAddModList-r17");
      for (const auto& e1 : *dl_ppw_pre_cfg_to_add_mod_list_r17) {
        e1.to_json(j);
      }
      j.end_array();
    }
    if (dl_ppw_pre_cfg_to_release_list_r17.is_present()) {
      j.start_array("dl-PPW-PreConfigToReleaseList-r17");
      for (const auto& e1 : *dl_ppw_pre_cfg_to_release_list_r17) {
        j.write_int(e1);
      }
      j.end_array();
    }
    if (non_cell_defining_ssb_r17.is_present()) {
      j.write_fieldname("nonCellDefiningSSB-r17");
      non_cell_defining_ssb_r17->to_json(j);
    }
    if (serving_cell_mo_r17_present) {
      j.write_int("servingCellMO-r17", serving_cell_mo_r17);
    }
  }
  j.end_obj();
}

// BWP-Downlink ::= SEQUENCE
SRSASN_CODE bwp_dl_s::pack(bit_ref& bref) const
{
  bref.pack(ext, 1);
  HANDLE_CODE(bref.pack(bwp_common_present, 1));
  HANDLE_CODE(bref.pack(bwp_ded_present, 1));

  HANDLE_CODE(pack_integer(bref, bwp_id, (uint8_t)0u, (uint8_t)4u));
  if (bwp_common_present) {
    HANDLE_CODE(bwp_common.pack(bref));
  }
  if (bwp_ded_present) {
    HANDLE_CODE(bwp_ded.pack(bref));
  }

  return SRSASN_SUCCESS;
}
SRSASN_CODE bwp_dl_s::unpack(cbit_ref& bref)
{
  bref.unpack(ext, 1);
  HANDLE_CODE(bref.unpack(bwp_common_present, 1));
  HANDLE_CODE(bref.unpack(bwp_ded_present, 1));

  HANDLE_CODE(unpack_integer(bwp_id, bref, (uint8_t)0u, (uint8_t)4u));
  if (bwp_common_present) {
    HANDLE_CODE(bwp_common.unpack(bref));
  }
  if (bwp_ded_present) {
    HANDLE_CODE(bwp_ded.unpack(bref));
  }

  return SRSASN_SUCCESS;
}
void bwp_dl_s::to_json(json_writer& j) const
{
  j.start_obj();
  j.write_int("bwp-Id", bwp_id);
  if (bwp_common_present) {
    j.write_fieldname("bwp-Common");
    bwp_common.to_json(j);
  }
  if (bwp_ded_present) {
    j.write_fieldname("bwp-Dedicated");
    bwp_ded.to_json(j);
  }
  j.end_obj();
}

// BWP-DownlinkDedicatedSDT-r17 ::= SEQUENCE
SRSASN_CODE bwp_dl_ded_sdt_r17_s::pack(bit_ref& bref) const
{
  bref.pack(ext, 1);
  HANDLE_CODE(bref.pack(pdcch_cfg_r17_present, 1));
  HANDLE_CODE(bref.pack(pdsch_cfg_r17_present, 1));

  if (pdcch_cfg_r17_present) {
    HANDLE_CODE(pdcch_cfg_r17.pack(bref));
  }
  if (pdsch_cfg_r17_present) {
    HANDLE_CODE(pdsch_cfg_r17.pack(bref));
  }

  return SRSASN_SUCCESS;
}
SRSASN_CODE bwp_dl_ded_sdt_r17_s::unpack(cbit_ref& bref)
{
  bref.unpack(ext, 1);
  HANDLE_CODE(bref.unpack(pdcch_cfg_r17_present, 1));
  HANDLE_CODE(bref.unpack(pdsch_cfg_r17_present, 1));

  if (pdcch_cfg_r17_present) {
    HANDLE_CODE(pdcch_cfg_r17.unpack(bref));
  }
  if (pdsch_cfg_r17_present) {
    HANDLE_CODE(pdsch_cfg_r17.unpack(bref));
  }

  return SRSASN_SUCCESS;
}
void bwp_dl_ded_sdt_r17_s::to_json(json_writer& j) const
{
  j.start_obj();
  if (pdcch_cfg_r17_present) {
    j.write_fieldname("pdcch-Config-r17");
    pdcch_cfg_r17.to_json(j);
  }
  if (pdsch_cfg_r17_present) {
    j.write_fieldname("pdsch-Config-r17");
    pdsch_cfg_r17.to_json(j);
  }
  j.end_obj();
}

// PUCCH-PathlossReferenceRS-r16 ::= SEQUENCE
SRSASN_CODE pucch_pathloss_ref_rs_r16_s::pack(bit_ref& bref) const
{
  HANDLE_CODE(pack_integer(bref, pucch_pathloss_ref_rs_id_r16, (uint8_t)4u, (uint8_t)63u));
  HANDLE_CODE(ref_sig_r16.pack(bref));

  return SRSASN_SUCCESS;
}
SRSASN_CODE pucch_pathloss_ref_rs_r16_s::unpack(cbit_ref& bref)
{
  HANDLE_CODE(unpack_integer(pucch_pathloss_ref_rs_id_r16, bref, (uint8_t)4u, (uint8_t)63u));
  HANDLE_CODE(ref_sig_r16.unpack(bref));

  return SRSASN_SUCCESS;
}
void pucch_pathloss_ref_rs_r16_s::to_json(json_writer& j) const
{
  j.start_obj();
  j.write_int("pucch-PathlossReferenceRS-Id-r16", pucch_pathloss_ref_rs_id_r16);
  j.write_fieldname("referenceSignal-r16");
  ref_sig_r16.to_json(j);
  j.end_obj();
}

void pucch_pathloss_ref_rs_r16_s::ref_sig_r16_c_::destroy_() {}
void pucch_pathloss_ref_rs_r16_s::ref_sig_r16_c_::set(types::options e)
{
  destroy_();
  type_ = e;
}
pucch_pathloss_ref_rs_r16_s::ref_sig_r16_c_::ref_sig_r16_c_(const pucch_pathloss_ref_rs_r16_s::ref_sig_r16_c_& other)
{
  type_ = other.type();
  switch (type_) {
    case types::ssb_idx_r16:
      c.init(other.c.get<uint8_t>());
      break;
    case types::csi_rs_idx_r16:
      c.init(other.c.get<uint8_t>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "pucch_pathloss_ref_rs_r16_s::ref_sig_r16_c_");
  }
}
pucch_pathloss_ref_rs_r16_s::ref_sig_r16_c_&
pucch_pathloss_ref_rs_r16_s::ref_sig_r16_c_::operator=(const pucch_pathloss_ref_rs_r16_s::ref_sig_r16_c_& other)
{
  if (this == &other) {
    return *this;
  }
  set(other.type());
  switch (type_) {
    case types::ssb_idx_r16:
      c.set(other.c.get<uint8_t>());
      break;
    case types::csi_rs_idx_r16:
      c.set(other.c.get<uint8_t>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "pucch_pathloss_ref_rs_r16_s::ref_sig_r16_c_");
  }

  return *this;
}
uint8_t& pucch_pathloss_ref_rs_r16_s::ref_sig_r16_c_::set_ssb_idx_r16()
{
  set(types::ssb_idx_r16);
  return c.get<uint8_t>();
}
uint8_t& pucch_pathloss_ref_rs_r16_s::ref_sig_r16_c_::set_csi_rs_idx_r16()
{
  set(types::csi_rs_idx_r16);
  return c.get<uint8_t>();
}
void pucch_pathloss_ref_rs_r16_s::ref_sig_r16_c_::to_json(json_writer& j) const
{
  j.start_obj();
  switch (type_) {
    case types::ssb_idx_r16:
      j.write_int("ssb-Index-r16", c.get<uint8_t>());
      break;
    case types::csi_rs_idx_r16:
      j.write_int("csi-RS-Index-r16", c.get<uint8_t>());
      break;
    default:
      log_invalid_choice_id(type_, "pucch_pathloss_ref_rs_r16_s::ref_sig_r16_c_");
  }
  j.end_obj();
}
SRSASN_CODE pucch_pathloss_ref_rs_r16_s::ref_sig_r16_c_::pack(bit_ref& bref) const
{
  type_.pack(bref);
  switch (type_) {
    case types::ssb_idx_r16:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)63u));
      break;
    case types::csi_rs_idx_r16:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)191u));
      break;
    default:
      log_invalid_choice_id(type_, "pucch_pathloss_ref_rs_r16_s::ref_sig_r16_c_");
      return SRSASN_ERROR_ENCODE_FAIL;
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE pucch_pathloss_ref_rs_r16_s::ref_sig_r16_c_::unpack(cbit_ref& bref)
{
  types e;
  e.unpack(bref);
  set(e);
  switch (type_) {
    case types::ssb_idx_r16:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)63u));
      break;
    case types::csi_rs_idx_r16:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)191u));
      break;
    default:
      log_invalid_choice_id(type_, "pucch_pathloss_ref_rs_r16_s::ref_sig_r16_c_");
      return SRSASN_ERROR_DECODE_FAIL;
  }
  return SRSASN_SUCCESS;
}

const char* pucch_pathloss_ref_rs_r16_s::ref_sig_r16_c_::types_opts::to_string() const
{
  static const char* names[] = {"ssb-Index-r16", "csi-RS-Index-r16"};
  return convert_enum_idx(names, 2, value, "pucch_pathloss_ref_rs_r16_s::ref_sig_r16_c_::types");
}

// PathlossReferenceRS-Config ::= CHOICE
void pathloss_ref_rs_cfg_c::destroy_() {}
void pathloss_ref_rs_cfg_c::set(types::options e)
{
  destroy_();
  type_ = e;
}
pathloss_ref_rs_cfg_c::pathloss_ref_rs_cfg_c(const pathloss_ref_rs_cfg_c& other)
{
  type_ = other.type();
  switch (type_) {
    case types::ssb_idx:
      c.init(other.c.get<uint8_t>());
      break;
    case types::csi_rs_idx:
      c.init(other.c.get<uint8_t>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "pathloss_ref_rs_cfg_c");
  }
}
pathloss_ref_rs_cfg_c& pathloss_ref_rs_cfg_c::operator=(const pathloss_ref_rs_cfg_c& other)
{
  if (this == &other) {
    return *this;
  }
  set(other.type());
  switch (type_) {
    case types::ssb_idx:
      c.set(other.c.get<uint8_t>());
      break;
    case types::csi_rs_idx:
      c.set(other.c.get<uint8_t>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "pathloss_ref_rs_cfg_c");
  }

  return *this;
}
uint8_t& pathloss_ref_rs_cfg_c::set_ssb_idx()
{
  set(types::ssb_idx);
  return c.get<uint8_t>();
}
uint8_t& pathloss_ref_rs_cfg_c::set_csi_rs_idx()
{
  set(types::csi_rs_idx);
  return c.get<uint8_t>();
}
void pathloss_ref_rs_cfg_c::to_json(json_writer& j) const
{
  j.start_obj();
  switch (type_) {
    case types::ssb_idx:
      j.write_int("ssb-Index", c.get<uint8_t>());
      break;
    case types::csi_rs_idx:
      j.write_int("csi-RS-Index", c.get<uint8_t>());
      break;
    default:
      log_invalid_choice_id(type_, "pathloss_ref_rs_cfg_c");
  }
  j.end_obj();
}
SRSASN_CODE pathloss_ref_rs_cfg_c::pack(bit_ref& bref) const
{
  type_.pack(bref);
  switch (type_) {
    case types::ssb_idx:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)63u));
      break;
    case types::csi_rs_idx:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)191u));
      break;
    default:
      log_invalid_choice_id(type_, "pathloss_ref_rs_cfg_c");
      return SRSASN_ERROR_ENCODE_FAIL;
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE pathloss_ref_rs_cfg_c::unpack(cbit_ref& bref)
{
  types e;
  e.unpack(bref);
  set(e);
  switch (type_) {
    case types::ssb_idx:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)63u));
      break;
    case types::csi_rs_idx:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)191u));
      break;
    default:
      log_invalid_choice_id(type_, "pathloss_ref_rs_cfg_c");
      return SRSASN_ERROR_DECODE_FAIL;
  }
  return SRSASN_SUCCESS;
}

const char* pathloss_ref_rs_cfg_c::types_opts::to_string() const
{
  static const char* names[] = {"ssb-Index", "csi-RS-Index"};
  return convert_enum_idx(names, 2, value, "pathloss_ref_rs_cfg_c::types");
}

// Alpha ::= ENUMERATED
const char* alpha_opts::to_string() const
{
  static const char* names[] = {"alpha0", "alpha04", "alpha05", "alpha06", "alpha07", "alpha08", "alpha09", "alpha1"};
  return convert_enum_idx(names, 8, value, "alpha_e");
}
float alpha_opts::to_number() const
{
  static const float numbers[] = {0.0, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0};
  return map_enum_number(numbers, 8, value, "alpha_e");
}
const char* alpha_opts::to_number_string() const
{
  static const char* number_strs[] = {"0", "0.4", "0.5", "0.6", "0.7", "0.8", "0.9", "1"};
  return convert_enum_idx(number_strs, 8, value, "alpha_e");
}

// BetaOffsets ::= SEQUENCE
SRSASN_CODE beta_offsets_s::pack(bit_ref& bref) const
{
  HANDLE_CODE(bref.pack(beta_offset_ack_idx1_present, 1));
  HANDLE_CODE(bref.pack(beta_offset_ack_idx2_present, 1));
  HANDLE_CODE(bref.pack(beta_offset_ack_idx3_present, 1));
  HANDLE_CODE(bref.pack(beta_offset_csi_part1_idx1_present, 1));
  HANDLE_CODE(bref.pack(beta_offset_csi_part1_idx2_present, 1));
  HANDLE_CODE(bref.pack(beta_offset_csi_part2_idx1_present, 1));
  HANDLE_CODE(bref.pack(beta_offset_csi_part2_idx2_present, 1));

  if (beta_offset_ack_idx1_present) {
    HANDLE_CODE(pack_integer(bref, beta_offset_ack_idx1, (uint8_t)0u, (uint8_t)31u));
  }
  if (beta_offset_ack_idx2_present) {
    HANDLE_CODE(pack_integer(bref, beta_offset_ack_idx2, (uint8_t)0u, (uint8_t)31u));
  }
  if (beta_offset_ack_idx3_present) {
    HANDLE_CODE(pack_integer(bref, beta_offset_ack_idx3, (uint8_t)0u, (uint8_t)31u));
  }
  if (beta_offset_csi_part1_idx1_present) {
    HANDLE_CODE(pack_integer(bref, beta_offset_csi_part1_idx1, (uint8_t)0u, (uint8_t)31u));
  }
  if (beta_offset_csi_part1_idx2_present) {
    HANDLE_CODE(pack_integer(bref, beta_offset_csi_part1_idx2, (uint8_t)0u, (uint8_t)31u));
  }
  if (beta_offset_csi_part2_idx1_present) {
    HANDLE_CODE(pack_integer(bref, beta_offset_csi_part2_idx1, (uint8_t)0u, (uint8_t)31u));
  }
  if (beta_offset_csi_part2_idx2_present) {
    HANDLE_CODE(pack_integer(bref, beta_offset_csi_part2_idx2, (uint8_t)0u, (uint8_t)31u));
  }

  return SRSASN_SUCCESS;
}
SRSASN_CODE beta_offsets_s::unpack(cbit_ref& bref)
{
  HANDLE_CODE(bref.unpack(beta_offset_ack_idx1_present, 1));
  HANDLE_CODE(bref.unpack(beta_offset_ack_idx2_present, 1));
  HANDLE_CODE(bref.unpack(beta_offset_ack_idx3_present, 1));
  HANDLE_CODE(bref.unpack(beta_offset_csi_part1_idx1_present, 1));
  HANDLE_CODE(bref.unpack(beta_offset_csi_part1_idx2_present, 1));
  HANDLE_CODE(bref.unpack(beta_offset_csi_part2_idx1_present, 1));
  HANDLE_CODE(bref.unpack(beta_offset_csi_part2_idx2_present, 1));

  if (beta_offset_ack_idx1_present) {
    HANDLE_CODE(unpack_integer(beta_offset_ack_idx1, bref, (uint8_t)0u, (uint8_t)31u));
  }
  if (beta_offset_ack_idx2_present) {
    HANDLE_CODE(unpack_integer(beta_offset_ack_idx2, bref, (uint8_t)0u, (uint8_t)31u));
  }
  if (beta_offset_ack_idx3_present) {
    HANDLE_CODE(unpack_integer(beta_offset_ack_idx3, bref, (uint8_t)0u, (uint8_t)31u));
  }
  if (beta_offset_csi_part1_idx1_present) {
    HANDLE_CODE(unpack_integer(beta_offset_csi_part1_idx1, bref, (uint8_t)0u, (uint8_t)31u));
  }
  if (beta_offset_csi_part1_idx2_present) {
    HANDLE_CODE(unpack_integer(beta_offset_csi_part1_idx2, bref, (uint8_t)0u, (uint8_t)31u));
  }
  if (beta_offset_csi_part2_idx1_present) {
    HANDLE_CODE(unpack_integer(beta_offset_csi_part2_idx1, bref, (uint8_t)0u, (uint8_t)31u));
  }
  if (beta_offset_csi_part2_idx2_present) {
    HANDLE_CODE(unpack_integer(beta_offset_csi_part2_idx2, bref, (uint8_t)0u, (uint8_t)31u));
  }

  return SRSASN_SUCCESS;
}
void beta_offsets_s::to_json(json_writer& j) const
{
  j.start_obj();
  if (beta_offset_ack_idx1_present) {
    j.write_int("betaOffsetACK-Index1", beta_offset_ack_idx1);
  }
  if (beta_offset_ack_idx2_present) {
    j.write_int("betaOffsetACK-Index2", beta_offset_ack_idx2);
  }
  if (beta_offset_ack_idx3_present) {
    j.write_int("betaOffsetACK-Index3", beta_offset_ack_idx3);
  }
  if (beta_offset_csi_part1_idx1_present) {
    j.write_int("betaOffsetCSI-Part1-Index1", beta_offset_csi_part1_idx1);
  }
  if (beta_offset_csi_part1_idx2_present) {
    j.write_int("betaOffsetCSI-Part1-Index2", beta_offset_csi_part1_idx2);
  }
  if (beta_offset_csi_part2_idx1_present) {
    j.write_int("betaOffsetCSI-Part2-Index1", beta_offset_csi_part2_idx1);
  }
  if (beta_offset_csi_part2_idx2_present) {
    j.write_int("betaOffsetCSI-Part2-Index2", beta_offset_csi_part2_idx2);
  }
  j.end_obj();
}

// DMRS-UplinkTransformPrecoding-r16 ::= SEQUENCE
SRSASN_CODE dmrs_ul_transform_precoding_r16_s::pack(bit_ref& bref) const
{
  HANDLE_CODE(bref.pack(pi2_bpsk_scrambling_id0_present, 1));
  HANDLE_CODE(bref.pack(pi2_bpsk_scrambling_id1_present, 1));

  if (pi2_bpsk_scrambling_id0_present) {
    HANDLE_CODE(pack_integer(bref, pi2_bpsk_scrambling_id0, (uint32_t)0u, (uint32_t)65535u));
  }
  if (pi2_bpsk_scrambling_id1_present) {
    HANDLE_CODE(pack_integer(bref, pi2_bpsk_scrambling_id1, (uint32_t)0u, (uint32_t)65535u));
  }

  return SRSASN_SUCCESS;
}
SRSASN_CODE dmrs_ul_transform_precoding_r16_s::unpack(cbit_ref& bref)
{
  HANDLE_CODE(bref.unpack(pi2_bpsk_scrambling_id0_present, 1));
  HANDLE_CODE(bref.unpack(pi2_bpsk_scrambling_id1_present, 1));

  if (pi2_bpsk_scrambling_id0_present) {
    HANDLE_CODE(unpack_integer(pi2_bpsk_scrambling_id0, bref, (uint32_t)0u, (uint32_t)65535u));
  }
  if (pi2_bpsk_scrambling_id1_present) {
    HANDLE_CODE(unpack_integer(pi2_bpsk_scrambling_id1, bref, (uint32_t)0u, (uint32_t)65535u));
  }

  return SRSASN_SUCCESS;
}
void dmrs_ul_transform_precoding_r16_s::to_json(json_writer& j) const
{
  j.start_obj();
  if (pi2_bpsk_scrambling_id0_present) {
    j.write_int("pi2BPSK-ScramblingID0", pi2_bpsk_scrambling_id0);
  }
  if (pi2_bpsk_scrambling_id1_present) {
    j.write_int("pi2BPSK-ScramblingID1", pi2_bpsk_scrambling_id1);
  }
  j.end_obj();
}

// P0-PUCCH ::= SEQUENCE
SRSASN_CODE p0_pucch_s::pack(bit_ref& bref) const
{
  HANDLE_CODE(pack_integer(bref, p0_pucch_id, (uint8_t)1u, (uint8_t)8u));
  HANDLE_CODE(pack_integer(bref, p0_pucch_value, (int8_t)-16, (int8_t)15));

  return SRSASN_SUCCESS;
}
SRSASN_CODE p0_pucch_s::unpack(cbit_ref& bref)
{
  HANDLE_CODE(unpack_integer(p0_pucch_id, bref, (uint8_t)1u, (uint8_t)8u));
  HANDLE_CODE(unpack_integer(p0_pucch_value, bref, (int8_t)-16, (int8_t)15));

  return SRSASN_SUCCESS;
}
void p0_pucch_s::to_json(json_writer& j) const
{
  j.start_obj();
  j.write_int("p0-PUCCH-Id", p0_pucch_id);
  j.write_int("p0-PUCCH-Value", p0_pucch_value);
  j.end_obj();
}

// PTRS-UplinkConfig ::= SEQUENCE
SRSASN_CODE ptrs_ul_cfg_s::pack(bit_ref& bref) const
{
  bref.pack(ext, 1);
  HANDLE_CODE(bref.pack(transform_precoder_disabled_present, 1));
  HANDLE_CODE(bref.pack(transform_precoder_enabled_present, 1));

  if (transform_precoder_disabled_present) {
    HANDLE_CODE(bref.pack(transform_precoder_disabled.freq_density_present, 1));
    HANDLE_CODE(bref.pack(transform_precoder_disabled.time_density_present, 1));
    HANDLE_CODE(bref.pack(transform_precoder_disabled.res_elem_offset_present, 1));
    if (transform_precoder_disabled.freq_density_present) {
      HANDLE_CODE(pack_fixed_seq_of(bref,
                                    transform_precoder_disabled.freq_density,
                                    transform_precoder_disabled.freq_density.size(),
                                    integer_packer<uint16_t>(1, 276)));
    }
    if (transform_precoder_disabled.time_density_present) {
      HANDLE_CODE(pack_fixed_seq_of(bref,
                                    transform_precoder_disabled.time_density,
                                    transform_precoder_disabled.time_density.size(),
                                    integer_packer<uint8_t>(0, 29)));
    }
    HANDLE_CODE(transform_precoder_disabled.max_nrof_ports.pack(bref));
    if (transform_precoder_disabled.res_elem_offset_present) {
      HANDLE_CODE(transform_precoder_disabled.res_elem_offset.pack(bref));
    }
    HANDLE_CODE(transform_precoder_disabled.ptrs_pwr.pack(bref));
  }
  if (transform_precoder_enabled_present) {
    HANDLE_CODE(bref.pack(transform_precoder_enabled.time_density_transform_precoding_present, 1));
    HANDLE_CODE(pack_fixed_seq_of(bref,
                                  transform_precoder_enabled.sample_density,
                                  transform_precoder_enabled.sample_density.size(),
                                  integer_packer<uint16_t>(1, 276)));
  }

  return SRSASN_SUCCESS;
}
SRSASN_CODE ptrs_ul_cfg_s::unpack(cbit_ref& bref)
{
  bref.unpack(ext, 1);
  HANDLE_CODE(bref.unpack(transform_precoder_disabled_present, 1));
  HANDLE_CODE(bref.unpack(transform_precoder_enabled_present, 1));

  if (transform_precoder_disabled_present) {
    HANDLE_CODE(bref.unpack(transform_precoder_disabled.freq_density_present, 1));
    HANDLE_CODE(bref.unpack(transform_precoder_disabled.time_density_present, 1));
    HANDLE_CODE(bref.unpack(transform_precoder_disabled.res_elem_offset_present, 1));
    if (transform_precoder_disabled.freq_density_present) {
      HANDLE_CODE(unpack_fixed_seq_of(transform_precoder_disabled.freq_density,
                                      bref,
                                      transform_precoder_disabled.freq_density.size(),
                                      integer_packer<uint16_t>(1, 276)));
    }
    if (transform_precoder_disabled.time_density_present) {
      HANDLE_CODE(unpack_fixed_seq_of(transform_precoder_disabled.time_density,
                                      bref,
                                      transform_precoder_disabled.time_density.size(),
                                      integer_packer<uint8_t>(0, 29)));
    }
    HANDLE_CODE(transform_precoder_disabled.max_nrof_ports.unpack(bref));
    if (transform_precoder_disabled.res_elem_offset_present) {
      HANDLE_CODE(transform_precoder_disabled.res_elem_offset.unpack(bref));
    }
    HANDLE_CODE(transform_precoder_disabled.ptrs_pwr.unpack(bref));
  }
  if (transform_precoder_enabled_present) {
    HANDLE_CODE(bref.unpack(transform_precoder_enabled.time_density_transform_precoding_present, 1));
    HANDLE_CODE(unpack_fixed_seq_of(transform_precoder_enabled.sample_density,
                                    bref,
                                    transform_precoder_enabled.sample_density.size(),
                                    integer_packer<uint16_t>(1, 276)));
  }

  return SRSASN_SUCCESS;
}
void ptrs_ul_cfg_s::to_json(json_writer& j) const
{
  j.start_obj();
  if (transform_precoder_disabled_present) {
    j.write_fieldname("transformPrecoderDisabled");
    j.start_obj();
    if (transform_precoder_disabled.freq_density_present) {
      j.start_array("frequencyDensity");
      for (const auto& e1 : transform_precoder_disabled.freq_density) {
        j.write_int(e1);
      }
      j.end_array();
    }
    if (transform_precoder_disabled.time_density_present) {
      j.start_array("timeDensity");
      for (const auto& e1 : transform_precoder_disabled.time_density) {
        j.write_int(e1);
      }
      j.end_array();
    }
    j.write_str("maxNrofPorts", transform_precoder_disabled.max_nrof_ports.to_string());
    if (transform_precoder_disabled.res_elem_offset_present) {
      j.write_str("resourceElementOffset", transform_precoder_disabled.res_elem_offset.to_string());
    }
    j.write_str("ptrs-Power", transform_precoder_disabled.ptrs_pwr.to_string());
    j.end_obj();
  }
  if (transform_precoder_enabled_present) {
    j.write_fieldname("transformPrecoderEnabled");
    j.start_obj();
    j.start_array("sampleDensity");
    for (const auto& e1 : transform_precoder_enabled.sample_density) {
      j.write_int(e1);
    }
    j.end_array();
    if (transform_precoder_enabled.time_density_transform_precoding_present) {
      j.write_str("timeDensityTransformPrecoding", "d2");
    }
    j.end_obj();
  }
  j.end_obj();
}

const char* ptrs_ul_cfg_s::transform_precoder_disabled_s_::max_nrof_ports_opts::to_string() const
{
  static const char* names[] = {"n1", "n2"};
  return convert_enum_idx(names, 2, value, "ptrs_ul_cfg_s::transform_precoder_disabled_s_::max_nrof_ports_e_");
}
uint8_t ptrs_ul_cfg_s::transform_precoder_disabled_s_::max_nrof_ports_opts::to_number() const
{
  static const uint8_t numbers[] = {1, 2};
  return map_enum_number(numbers, 2, value, "ptrs_ul_cfg_s::transform_precoder_disabled_s_::max_nrof_ports_e_");
}

const char* ptrs_ul_cfg_s::transform_precoder_disabled_s_::res_elem_offset_opts::to_string() const
{
  static const char* names[] = {"offset01", "offset10", "offset11"};
  return convert_enum_idx(names, 3, value, "ptrs_ul_cfg_s::transform_precoder_disabled_s_::res_elem_offset_e_");
}
float ptrs_ul_cfg_s::transform_precoder_disabled_s_::res_elem_offset_opts::to_number() const
{
  static const float numbers[] = {0.1, 1.0, 1.1};
  return map_enum_number(numbers, 3, value, "ptrs_ul_cfg_s::transform_precoder_disabled_s_::res_elem_offset_e_");
}
const char* ptrs_ul_cfg_s::transform_precoder_disabled_s_::res_elem_offset_opts::to_number_string() const
{
  static const char* number_strs[] = {"0.1", "1.0", "1.1"};
  return convert_enum_idx(number_strs, 3, value, "ptrs_ul_cfg_s::transform_precoder_disabled_s_::res_elem_offset_e_");
}

const char* ptrs_ul_cfg_s::transform_precoder_disabled_s_::ptrs_pwr_opts::to_string() const
{
  static const char* names[] = {"p00", "p01", "p10", "p11"};
  return convert_enum_idx(names, 4, value, "ptrs_ul_cfg_s::transform_precoder_disabled_s_::ptrs_pwr_e_");
}
float ptrs_ul_cfg_s::transform_precoder_disabled_s_::ptrs_pwr_opts::to_number() const
{
  static const float numbers[] = {0.0, 0.1, 1.0, 1.1};
  return map_enum_number(numbers, 4, value, "ptrs_ul_cfg_s::transform_precoder_disabled_s_::ptrs_pwr_e_");
}
const char* ptrs_ul_cfg_s::transform_precoder_disabled_s_::ptrs_pwr_opts::to_number_string() const
{
  static const char* number_strs[] = {"0.0", "0.1", "1.0", "1.1"};
  return convert_enum_idx(number_strs, 4, value, "ptrs_ul_cfg_s::transform_precoder_disabled_s_::ptrs_pwr_e_");
}

// PUCCH-MaxCodeRate ::= ENUMERATED
const char* pucch_max_code_rate_opts::to_string() const
{
  static const char* names[] = {
      "zeroDot08", "zeroDot15", "zeroDot25", "zeroDot35", "zeroDot45", "zeroDot60", "zeroDot80"};
  return convert_enum_idx(names, 7, value, "pucch_max_code_rate_e");
}
float pucch_max_code_rate_opts::to_number() const
{
  static const float numbers[] = {0.08, 0.15, 0.25, 0.35, 0.45, 0.6, 0.8};
  return map_enum_number(numbers, 7, value, "pucch_max_code_rate_e");
}
const char* pucch_max_code_rate_opts::to_number_string() const
{
  static const char* number_strs[] = {"0.08", "0.15", "0.25", "0.35", "0.45", "0.60", "0.80"};
  return convert_enum_idx(number_strs, 7, value, "pucch_max_code_rate_e");
}

// PUCCH-PathlossReferenceRS ::= SEQUENCE
SRSASN_CODE pucch_pathloss_ref_rs_s::pack(bit_ref& bref) const
{
  HANDLE_CODE(pack_integer(bref, pucch_pathloss_ref_rs_id, (uint8_t)0u, (uint8_t)3u));
  HANDLE_CODE(ref_sig.pack(bref));

  return SRSASN_SUCCESS;
}
SRSASN_CODE pucch_pathloss_ref_rs_s::unpack(cbit_ref& bref)
{
  HANDLE_CODE(unpack_integer(pucch_pathloss_ref_rs_id, bref, (uint8_t)0u, (uint8_t)3u));
  HANDLE_CODE(ref_sig.unpack(bref));

  return SRSASN_SUCCESS;
}
void pucch_pathloss_ref_rs_s::to_json(json_writer& j) const
{
  j.start_obj();
  j.write_int("pucch-PathlossReferenceRS-Id", pucch_pathloss_ref_rs_id);
  j.write_fieldname("referenceSignal");
  ref_sig.to_json(j);
  j.end_obj();
}

void pucch_pathloss_ref_rs_s::ref_sig_c_::destroy_() {}
void pucch_pathloss_ref_rs_s::ref_sig_c_::set(types::options e)
{
  destroy_();
  type_ = e;
}
pucch_pathloss_ref_rs_s::ref_sig_c_::ref_sig_c_(const pucch_pathloss_ref_rs_s::ref_sig_c_& other)
{
  type_ = other.type();
  switch (type_) {
    case types::ssb_idx:
      c.init(other.c.get<uint8_t>());
      break;
    case types::csi_rs_idx:
      c.init(other.c.get<uint8_t>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "pucch_pathloss_ref_rs_s::ref_sig_c_");
  }
}
pucch_pathloss_ref_rs_s::ref_sig_c_&
pucch_pathloss_ref_rs_s::ref_sig_c_::operator=(const pucch_pathloss_ref_rs_s::ref_sig_c_& other)
{
  if (this == &other) {
    return *this;
  }
  set(other.type());
  switch (type_) {
    case types::ssb_idx:
      c.set(other.c.get<uint8_t>());
      break;
    case types::csi_rs_idx:
      c.set(other.c.get<uint8_t>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "pucch_pathloss_ref_rs_s::ref_sig_c_");
  }

  return *this;
}
uint8_t& pucch_pathloss_ref_rs_s::ref_sig_c_::set_ssb_idx()
{
  set(types::ssb_idx);
  return c.get<uint8_t>();
}
uint8_t& pucch_pathloss_ref_rs_s::ref_sig_c_::set_csi_rs_idx()
{
  set(types::csi_rs_idx);
  return c.get<uint8_t>();
}
void pucch_pathloss_ref_rs_s::ref_sig_c_::to_json(json_writer& j) const
{
  j.start_obj();
  switch (type_) {
    case types::ssb_idx:
      j.write_int("ssb-Index", c.get<uint8_t>());
      break;
    case types::csi_rs_idx:
      j.write_int("csi-RS-Index", c.get<uint8_t>());
      break;
    default:
      log_invalid_choice_id(type_, "pucch_pathloss_ref_rs_s::ref_sig_c_");
  }
  j.end_obj();
}
SRSASN_CODE pucch_pathloss_ref_rs_s::ref_sig_c_::pack(bit_ref& bref) const
{
  type_.pack(bref);
  switch (type_) {
    case types::ssb_idx:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)63u));
      break;
    case types::csi_rs_idx:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)191u));
      break;
    default:
      log_invalid_choice_id(type_, "pucch_pathloss_ref_rs_s::ref_sig_c_");
      return SRSASN_ERROR_ENCODE_FAIL;
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE pucch_pathloss_ref_rs_s::ref_sig_c_::unpack(cbit_ref& bref)
{
  types e;
  e.unpack(bref);
  set(e);
  switch (type_) {
    case types::ssb_idx:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)63u));
      break;
    case types::csi_rs_idx:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)191u));
      break;
    default:
      log_invalid_choice_id(type_, "pucch_pathloss_ref_rs_s::ref_sig_c_");
      return SRSASN_ERROR_DECODE_FAIL;
  }
  return SRSASN_SUCCESS;
}

const char* pucch_pathloss_ref_rs_s::ref_sig_c_::types_opts::to_string() const
{
  static const char* names[] = {"ssb-Index", "csi-RS-Index"};
  return convert_enum_idx(names, 2, value, "pucch_pathloss_ref_rs_s::ref_sig_c_::types");
}

// PUCCH-SRS ::= SEQUENCE
SRSASN_CODE pucch_srs_s::pack(bit_ref& bref) const
{
  HANDLE_CODE(pack_integer(bref, res, (uint8_t)0u, (uint8_t)63u));
  HANDLE_CODE(pack_integer(bref, ul_bwp, (uint8_t)0u, (uint8_t)4u));

  return SRSASN_SUCCESS;
}
SRSASN_CODE pucch_srs_s::unpack(cbit_ref& bref)
{
  HANDLE_CODE(unpack_integer(res, bref, (uint8_t)0u, (uint8_t)63u));
  HANDLE_CODE(unpack_integer(ul_bwp, bref, (uint8_t)0u, (uint8_t)4u));

  return SRSASN_SUCCESS;
}
void pucch_srs_s::to_json(json_writer& j) const
{
  j.start_obj();
  j.write_int("resource", res);
  j.write_int("uplinkBWP", ul_bwp);
  j.end_obj();
}

// PUCCH-format0 ::= SEQUENCE
SRSASN_CODE pucch_format0_s::pack(bit_ref& bref) const
{
  HANDLE_CODE(pack_integer(bref, init_cyclic_shift, (uint8_t)0u, (uint8_t)11u));
  HANDLE_CODE(pack_integer(bref, nrof_symbols, (uint8_t)1u, (uint8_t)2u));
  HANDLE_CODE(pack_integer(bref, start_symbol_idx, (uint8_t)0u, (uint8_t)13u));

  return SRSASN_SUCCESS;
}
SRSASN_CODE pucch_format0_s::unpack(cbit_ref& bref)
{
  HANDLE_CODE(unpack_integer(init_cyclic_shift, bref, (uint8_t)0u, (uint8_t)11u));
  HANDLE_CODE(unpack_integer(nrof_symbols, bref, (uint8_t)1u, (uint8_t)2u));
  HANDLE_CODE(unpack_integer(start_symbol_idx, bref, (uint8_t)0u, (uint8_t)13u));

  return SRSASN_SUCCESS;
}
void pucch_format0_s::to_json(json_writer& j) const
{
  j.start_obj();
  j.write_int("initialCyclicShift", init_cyclic_shift);
  j.write_int("nrofSymbols", nrof_symbols);
  j.write_int("startingSymbolIndex", start_symbol_idx);
  j.end_obj();
}

// PUCCH-format1 ::= SEQUENCE
SRSASN_CODE pucch_format1_s::pack(bit_ref& bref) const
{
  HANDLE_CODE(pack_integer(bref, init_cyclic_shift, (uint8_t)0u, (uint8_t)11u));
  HANDLE_CODE(pack_integer(bref, nrof_symbols, (uint8_t)4u, (uint8_t)14u));
  HANDLE_CODE(pack_integer(bref, start_symbol_idx, (uint8_t)0u, (uint8_t)10u));
  HANDLE_CODE(pack_integer(bref, time_domain_occ, (uint8_t)0u, (uint8_t)6u));

  return SRSASN_SUCCESS;
}
SRSASN_CODE pucch_format1_s::unpack(cbit_ref& bref)
{
  HANDLE_CODE(unpack_integer(init_cyclic_shift, bref, (uint8_t)0u, (uint8_t)11u));
  HANDLE_CODE(unpack_integer(nrof_symbols, bref, (uint8_t)4u, (uint8_t)14u));
  HANDLE_CODE(unpack_integer(start_symbol_idx, bref, (uint8_t)0u, (uint8_t)10u));
  HANDLE_CODE(unpack_integer(time_domain_occ, bref, (uint8_t)0u, (uint8_t)6u));

  return SRSASN_SUCCESS;
}
void pucch_format1_s::to_json(json_writer& j) const
{
  j.start_obj();
  j.write_int("initialCyclicShift", init_cyclic_shift);
  j.write_int("nrofSymbols", nrof_symbols);
  j.write_int("startingSymbolIndex", start_symbol_idx);
  j.write_int("timeDomainOCC", time_domain_occ);
  j.end_obj();
}

// PUCCH-format2 ::= SEQUENCE
SRSASN_CODE pucch_format2_s::pack(bit_ref& bref) const
{
  HANDLE_CODE(pack_integer(bref, nrof_prbs, (uint8_t)1u, (uint8_t)16u));
  HANDLE_CODE(pack_integer(bref, nrof_symbols, (uint8_t)1u, (uint8_t)2u));
  HANDLE_CODE(pack_integer(bref, start_symbol_idx, (uint8_t)0u, (uint8_t)13u));

  return SRSASN_SUCCESS;
}
SRSASN_CODE pucch_format2_s::unpack(cbit_ref& bref)
{
  HANDLE_CODE(unpack_integer(nrof_prbs, bref, (uint8_t)1u, (uint8_t)16u));
  HANDLE_CODE(unpack_integer(nrof_symbols, bref, (uint8_t)1u, (uint8_t)2u));
  HANDLE_CODE(unpack_integer(start_symbol_idx, bref, (uint8_t)0u, (uint8_t)13u));

  return SRSASN_SUCCESS;
}
void pucch_format2_s::to_json(json_writer& j) const
{
  j.start_obj();
  j.write_int("nrofPRBs", nrof_prbs);
  j.write_int("nrofSymbols", nrof_symbols);
  j.write_int("startingSymbolIndex", start_symbol_idx);
  j.end_obj();
}

// PUCCH-format3 ::= SEQUENCE
SRSASN_CODE pucch_format3_s::pack(bit_ref& bref) const
{
  HANDLE_CODE(pack_integer(bref, nrof_prbs, (uint8_t)1u, (uint8_t)16u));
  HANDLE_CODE(pack_integer(bref, nrof_symbols, (uint8_t)4u, (uint8_t)14u));
  HANDLE_CODE(pack_integer(bref, start_symbol_idx, (uint8_t)0u, (uint8_t)10u));

  return SRSASN_SUCCESS;
}
SRSASN_CODE pucch_format3_s::unpack(cbit_ref& bref)
{
  HANDLE_CODE(unpack_integer(nrof_prbs, bref, (uint8_t)1u, (uint8_t)16u));
  HANDLE_CODE(unpack_integer(nrof_symbols, bref, (uint8_t)4u, (uint8_t)14u));
  HANDLE_CODE(unpack_integer(start_symbol_idx, bref, (uint8_t)0u, (uint8_t)10u));

  return SRSASN_SUCCESS;
}
void pucch_format3_s::to_json(json_writer& j) const
{
  j.start_obj();
  j.write_int("nrofPRBs", nrof_prbs);
  j.write_int("nrofSymbols", nrof_symbols);
  j.write_int("startingSymbolIndex", start_symbol_idx);
  j.end_obj();
}

// PUCCH-format4 ::= SEQUENCE
SRSASN_CODE pucch_format4_s::pack(bit_ref& bref) const
{
  HANDLE_CODE(pack_integer(bref, nrof_symbols, (uint8_t)4u, (uint8_t)14u));
  HANDLE_CODE(occ_len.pack(bref));
  HANDLE_CODE(occ_idx.pack(bref));
  HANDLE_CODE(pack_integer(bref, start_symbol_idx, (uint8_t)0u, (uint8_t)10u));

  return SRSASN_SUCCESS;
}
SRSASN_CODE pucch_format4_s::unpack(cbit_ref& bref)
{
  HANDLE_CODE(unpack_integer(nrof_symbols, bref, (uint8_t)4u, (uint8_t)14u));
  HANDLE_CODE(occ_len.unpack(bref));
  HANDLE_CODE(occ_idx.unpack(bref));
  HANDLE_CODE(unpack_integer(start_symbol_idx, bref, (uint8_t)0u, (uint8_t)10u));

  return SRSASN_SUCCESS;
}
void pucch_format4_s::to_json(json_writer& j) const
{
  j.start_obj();
  j.write_int("nrofSymbols", nrof_symbols);
  j.write_str("occ-Length", occ_len.to_string());
  j.write_str("occ-Index", occ_idx.to_string());
  j.write_int("startingSymbolIndex", start_symbol_idx);
  j.end_obj();
}

const char* pucch_format4_s::occ_len_opts::to_string() const
{
  static const char* names[] = {"n2", "n4"};
  return convert_enum_idx(names, 2, value, "pucch_format4_s::occ_len_e_");
}
uint8_t pucch_format4_s::occ_len_opts::to_number() const
{
  static const uint8_t numbers[] = {2, 4};
  return map_enum_number(numbers, 2, value, "pucch_format4_s::occ_len_e_");
}

const char* pucch_format4_s::occ_idx_opts::to_string() const
{
  static const char* names[] = {"n0", "n1", "n2", "n3"};
  return convert_enum_idx(names, 4, value, "pucch_format4_s::occ_idx_e_");
}
uint8_t pucch_format4_s::occ_idx_opts::to_number() const
{
  static const uint8_t numbers[] = {0, 1, 2, 3};
  return map_enum_number(numbers, 4, value, "pucch_format4_s::occ_idx_e_");
}

// PUSCH-Allocation-r16 ::= SEQUENCE
SRSASN_CODE pusch_alloc_r16_s::pack(bit_ref& bref) const
{
  bref.pack(ext, 1);
  HANDLE_CODE(bref.pack(map_type_r16_present, 1));
  HANDLE_CODE(bref.pack(start_symbol_and_len_r16_present, 1));
  HANDLE_CODE(bref.pack(start_symbol_r16_present, 1));
  HANDLE_CODE(bref.pack(len_r16_present, 1));
  HANDLE_CODE(bref.pack(nof_repeats_r16_present, 1));

  if (map_type_r16_present) {
    HANDLE_CODE(map_type_r16.pack(bref));
  }
  if (start_symbol_and_len_r16_present) {
    HANDLE_CODE(pack_integer(bref, start_symbol_and_len_r16, (uint8_t)0u, (uint8_t)127u));
  }
  if (start_symbol_r16_present) {
    HANDLE_CODE(pack_integer(bref, start_symbol_r16, (uint8_t)0u, (uint8_t)13u));
  }
  if (len_r16_present) {
    HANDLE_CODE(pack_integer(bref, len_r16, (uint8_t)1u, (uint8_t)14u));
  }
  if (nof_repeats_r16_present) {
    HANDLE_CODE(nof_repeats_r16.pack(bref));
  }

  if (ext) {
    ext_groups_packer_guard group_flags;
    group_flags[0] |= nof_repeats_ext_r17_present;
    group_flags[0] |= nof_slots_t_bo_ms_r17_present;
    group_flags[0] |= extended_k2_r17_present;
    group_flags.pack(bref);

    if (group_flags[0]) {
      varlength_field_pack_guard varlen_scope(bref, false);

      HANDLE_CODE(bref.pack(nof_repeats_ext_r17_present, 1));
      HANDLE_CODE(bref.pack(nof_slots_t_bo_ms_r17_present, 1));
      HANDLE_CODE(bref.pack(extended_k2_r17_present, 1));
      if (nof_repeats_ext_r17_present) {
        HANDLE_CODE(nof_repeats_ext_r17.pack(bref));
      }
      if (nof_slots_t_bo_ms_r17_present) {
        HANDLE_CODE(nof_slots_t_bo_ms_r17.pack(bref));
      }
      if (extended_k2_r17_present) {
        HANDLE_CODE(pack_integer(bref, extended_k2_r17, (uint8_t)0u, (uint8_t)128u));
      }
    }
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE pusch_alloc_r16_s::unpack(cbit_ref& bref)
{
  bref.unpack(ext, 1);
  HANDLE_CODE(bref.unpack(map_type_r16_present, 1));
  HANDLE_CODE(bref.unpack(start_symbol_and_len_r16_present, 1));
  HANDLE_CODE(bref.unpack(start_symbol_r16_present, 1));
  HANDLE_CODE(bref.unpack(len_r16_present, 1));
  HANDLE_CODE(bref.unpack(nof_repeats_r16_present, 1));

  if (map_type_r16_present) {
    HANDLE_CODE(map_type_r16.unpack(bref));
  }
  if (start_symbol_and_len_r16_present) {
    HANDLE_CODE(unpack_integer(start_symbol_and_len_r16, bref, (uint8_t)0u, (uint8_t)127u));
  }
  if (start_symbol_r16_present) {
    HANDLE_CODE(unpack_integer(start_symbol_r16, bref, (uint8_t)0u, (uint8_t)13u));
  }
  if (len_r16_present) {
    HANDLE_CODE(unpack_integer(len_r16, bref, (uint8_t)1u, (uint8_t)14u));
  }
  if (nof_repeats_r16_present) {
    HANDLE_CODE(nof_repeats_r16.unpack(bref));
  }

  if (ext) {
    ext_groups_unpacker_guard group_flags(1);
    group_flags.unpack(bref);

    if (group_flags[0]) {
      varlength_field_unpack_guard varlen_scope(bref, false);

      HANDLE_CODE(bref.unpack(nof_repeats_ext_r17_present, 1));
      HANDLE_CODE(bref.unpack(nof_slots_t_bo_ms_r17_present, 1));
      HANDLE_CODE(bref.unpack(extended_k2_r17_present, 1));
      if (nof_repeats_ext_r17_present) {
        HANDLE_CODE(nof_repeats_ext_r17.unpack(bref));
      }
      if (nof_slots_t_bo_ms_r17_present) {
        HANDLE_CODE(nof_slots_t_bo_ms_r17.unpack(bref));
      }
      if (extended_k2_r17_present) {
        HANDLE_CODE(unpack_integer(extended_k2_r17, bref, (uint8_t)0u, (uint8_t)128u));
      }
    }
  }
  return SRSASN_SUCCESS;
}
void pusch_alloc_r16_s::to_json(json_writer& j) const
{
  j.start_obj();
  if (map_type_r16_present) {
    j.write_str("mappingType-r16", map_type_r16.to_string());
  }
  if (start_symbol_and_len_r16_present) {
    j.write_int("startSymbolAndLength-r16", start_symbol_and_len_r16);
  }
  if (start_symbol_r16_present) {
    j.write_int("startSymbol-r16", start_symbol_r16);
  }
  if (len_r16_present) {
    j.write_int("length-r16", len_r16);
  }
  if (nof_repeats_r16_present) {
    j.write_str("numberOfRepetitions-r16", nof_repeats_r16.to_string());
  }
  if (ext) {
    if (nof_repeats_ext_r17_present) {
      j.write_str("numberOfRepetitionsExt-r17", nof_repeats_ext_r17.to_string());
    }
    if (nof_slots_t_bo_ms_r17_present) {
      j.write_str("numberOfSlotsTBoMS-r17", nof_slots_t_bo_ms_r17.to_string());
    }
    if (extended_k2_r17_present) {
      j.write_int("extendedK2-r17", extended_k2_r17);
    }
  }
  j.end_obj();
}

const char* pusch_alloc_r16_s::map_type_r16_opts::to_string() const
{
  static const char* names[] = {"typeA", "typeB"};
  return convert_enum_idx(names, 2, value, "pusch_alloc_r16_s::map_type_r16_e_");
}

const char* pusch_alloc_r16_s::nof_repeats_r16_opts::to_string() const
{
  static const char* names[] = {"n1", "n2", "n3", "n4", "n7", "n8", "n12", "n16"};
  return convert_enum_idx(names, 8, value, "pusch_alloc_r16_s::nof_repeats_r16_e_");
}
uint8_t pusch_alloc_r16_s::nof_repeats_r16_opts::to_number() const
{
  static const uint8_t numbers[] = {1, 2, 3, 4, 7, 8, 12, 16};
  return map_enum_number(numbers, 8, value, "pusch_alloc_r16_s::nof_repeats_r16_e_");
}

const char* pusch_alloc_r16_s::nof_repeats_ext_r17_opts::to_string() const
{
  static const char* names[] = {"n1",
                                "n2",
                                "n3",
                                "n4",
                                "n7",
                                "n8",
                                "n12",
                                "n16",
                                "n20",
                                "n24",
                                "n28",
                                "n32",
                                "spare4",
                                "spare3",
                                "spare2",
                                "spare1"};
  return convert_enum_idx(names, 16, value, "pusch_alloc_r16_s::nof_repeats_ext_r17_e_");
}
uint8_t pusch_alloc_r16_s::nof_repeats_ext_r17_opts::to_number() const
{
  static const uint8_t numbers[] = {1, 2, 3, 4, 7, 8, 12, 16, 20, 24, 28, 32};
  return map_enum_number(numbers, 12, value, "pusch_alloc_r16_s::nof_repeats_ext_r17_e_");
}

const char* pusch_alloc_r16_s::nof_slots_t_bo_ms_r17_opts::to_string() const
{
  static const char* names[] = {"n1", "n2", "n4", "n8", "spare4", "spare3", "spare2", "spare1"};
  return convert_enum_idx(names, 8, value, "pusch_alloc_r16_s::nof_slots_t_bo_ms_r17_e_");
}
uint8_t pusch_alloc_r16_s::nof_slots_t_bo_ms_r17_opts::to_number() const
{
  static const uint8_t numbers[] = {1, 2, 4, 8};
  return map_enum_number(numbers, 4, value, "pusch_alloc_r16_s::nof_slots_t_bo_ms_r17_e_");
}

// PathlossReferenceRS-r16 ::= SEQUENCE
SRSASN_CODE pathloss_ref_rs_r16_s::pack(bit_ref& bref) const
{
  HANDLE_CODE(pack_integer(bref, srs_pathloss_ref_rs_id_r16, (uint8_t)0u, (uint8_t)63u));
  HANDLE_CODE(pathloss_ref_rs_r16.pack(bref));

  return SRSASN_SUCCESS;
}
SRSASN_CODE pathloss_ref_rs_r16_s::unpack(cbit_ref& bref)
{
  HANDLE_CODE(unpack_integer(srs_pathloss_ref_rs_id_r16, bref, (uint8_t)0u, (uint8_t)63u));
  HANDLE_CODE(pathloss_ref_rs_r16.unpack(bref));

  return SRSASN_SUCCESS;
}
void pathloss_ref_rs_r16_s::to_json(json_writer& j) const
{
  j.start_obj();
  j.write_int("srs-PathlossReferenceRS-Id-r16", srs_pathloss_ref_rs_id_r16);
  j.write_fieldname("pathlossReferenceRS-r16");
  pathloss_ref_rs_r16.to_json(j);
  j.end_obj();
}

// SPS-PUCCH-AN-r16 ::= SEQUENCE
SRSASN_CODE sps_pucch_an_r16_s::pack(bit_ref& bref) const
{
  HANDLE_CODE(bref.pack(max_payload_size_r16_present, 1));

  HANDLE_CODE(pack_integer(bref, sps_pucch_an_res_id_r16, (uint8_t)0u, (uint8_t)127u));
  if (max_payload_size_r16_present) {
    HANDLE_CODE(pack_integer(bref, max_payload_size_r16, (uint16_t)4u, (uint16_t)256u));
  }

  return SRSASN_SUCCESS;
}
SRSASN_CODE sps_pucch_an_r16_s::unpack(cbit_ref& bref)
{
  HANDLE_CODE(bref.unpack(max_payload_size_r16_present, 1));

  HANDLE_CODE(unpack_integer(sps_pucch_an_res_id_r16, bref, (uint8_t)0u, (uint8_t)127u));
  if (max_payload_size_r16_present) {
    HANDLE_CODE(unpack_integer(max_payload_size_r16, bref, (uint16_t)4u, (uint16_t)256u));
  }

  return SRSASN_SUCCESS;
}
void sps_pucch_an_r16_s::to_json(json_writer& j) const
{
  j.start_obj();
  j.write_int("sps-PUCCH-AN-ResourceID-r16", sps_pucch_an_res_id_r16);
  if (max_payload_size_r16_present) {
    j.write_int("maxPayloadSize-r16", max_payload_size_r16);
  }
  j.end_obj();
}

// BetaOffsetsCrossPriSelCG-r17 ::= CHOICE
void beta_offsets_cross_pri_sel_cg_r17_c::destroy_()
{
  switch (type_) {
    case types::dyn_r17:
      c.destroy<dyn_r17_l_>();
      break;
    case types::semi_static_r17:
      c.destroy<beta_offsets_cross_pri_r17_l>();
      break;
    default:
      break;
  }
}
void beta_offsets_cross_pri_sel_cg_r17_c::set(types::options e)
{
  destroy_();
  type_ = e;
  switch (type_) {
    case types::dyn_r17:
      c.init<dyn_r17_l_>();
      break;
    case types::semi_static_r17:
      c.init<beta_offsets_cross_pri_r17_l>();
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "beta_offsets_cross_pri_sel_cg_r17_c");
  }
}
beta_offsets_cross_pri_sel_cg_r17_c::beta_offsets_cross_pri_sel_cg_r17_c(
    const beta_offsets_cross_pri_sel_cg_r17_c& other)
{
  type_ = other.type();
  switch (type_) {
    case types::dyn_r17:
      c.init(other.c.get<dyn_r17_l_>());
      break;
    case types::semi_static_r17:
      c.init(other.c.get<beta_offsets_cross_pri_r17_l>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "beta_offsets_cross_pri_sel_cg_r17_c");
  }
}
beta_offsets_cross_pri_sel_cg_r17_c&
beta_offsets_cross_pri_sel_cg_r17_c::operator=(const beta_offsets_cross_pri_sel_cg_r17_c& other)
{
  if (this == &other) {
    return *this;
  }
  set(other.type());
  switch (type_) {
    case types::dyn_r17:
      c.set(other.c.get<dyn_r17_l_>());
      break;
    case types::semi_static_r17:
      c.set(other.c.get<beta_offsets_cross_pri_r17_l>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "beta_offsets_cross_pri_sel_cg_r17_c");
  }

  return *this;
}
beta_offsets_cross_pri_sel_cg_r17_c::dyn_r17_l_& beta_offsets_cross_pri_sel_cg_r17_c::set_dyn_r17()
{
  set(types::dyn_r17);
  return c.get<dyn_r17_l_>();
}
beta_offsets_cross_pri_r17_l& beta_offsets_cross_pri_sel_cg_r17_c::set_semi_static_r17()
{
  set(types::semi_static_r17);
  return c.get<beta_offsets_cross_pri_r17_l>();
}
void beta_offsets_cross_pri_sel_cg_r17_c::to_json(json_writer& j) const
{
  j.start_obj();
  switch (type_) {
    case types::dyn_r17:
      j.start_array("dynamic-r17");
      for (const auto& e1 : c.get<dyn_r17_l_>()) {
        j.start_array();
        for (const auto& e2 : e1) {
          j.write_int(e2);
        }
        j.end_array();
      }
      j.end_array();
      break;
    case types::semi_static_r17:
      j.start_array("semiStatic-r17");
      for (const auto& e1 : c.get<beta_offsets_cross_pri_r17_l>()) {
        j.write_int(e1);
      }
      j.end_array();
      break;
    default:
      log_invalid_choice_id(type_, "beta_offsets_cross_pri_sel_cg_r17_c");
  }
  j.end_obj();
}
SRSASN_CODE beta_offsets_cross_pri_sel_cg_r17_c::pack(bit_ref& bref) const
{
  type_.pack(bref);
  switch (type_) {
    case types::dyn_r17:
      HANDLE_CODE(pack_dyn_seq_of(bref,
                                  c.get<dyn_r17_l_>(),
                                  1,
                                  4,
                                  FixedSeqOfPacker<integer_packer<uint8_t>>(3, integer_packer<uint8_t>(0, 31))));
      break;
    case types::semi_static_r17:
      HANDLE_CODE(pack_fixed_seq_of(bref,
                                    c.get<beta_offsets_cross_pri_r17_l>(),
                                    c.get<beta_offsets_cross_pri_r17_l>().size(),
                                    integer_packer<uint8_t>(0, 31)));
      break;
    default:
      log_invalid_choice_id(type_, "beta_offsets_cross_pri_sel_cg_r17_c");
      return SRSASN_ERROR_ENCODE_FAIL;
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE beta_offsets_cross_pri_sel_cg_r17_c::unpack(cbit_ref& bref)
{
  types e;
  e.unpack(bref);
  set(e);
  switch (type_) {
    case types::dyn_r17:
      HANDLE_CODE(unpack_dyn_seq_of(c.get<dyn_r17_l_>(),
                                    bref,
                                    1,
                                    4,
                                    FixedSeqOfPacker<integer_packer<uint8_t>>(3, integer_packer<uint8_t>(0, 31))));
      break;
    case types::semi_static_r17:
      HANDLE_CODE(unpack_fixed_seq_of(c.get<beta_offsets_cross_pri_r17_l>(),
                                      bref,
                                      c.get<beta_offsets_cross_pri_r17_l>().size(),
                                      integer_packer<uint8_t>(0, 31)));
      break;
    default:
      log_invalid_choice_id(type_, "beta_offsets_cross_pri_sel_cg_r17_c");
      return SRSASN_ERROR_DECODE_FAIL;
  }
  return SRSASN_SUCCESS;
}

const char* beta_offsets_cross_pri_sel_cg_r17_c::types_opts::to_string() const
{
  static const char* names[] = {"dynamic-r17", "semiStatic-r17"};
  return convert_enum_idx(names, 2, value, "beta_offsets_cross_pri_sel_cg_r17_c::types");
}

// CG-COT-Sharing-r16 ::= CHOICE
void cg_cot_sharing_r16_c::set(types::options e)
{
  type_ = e;
}
void cg_cot_sharing_r16_c::set_no_cot_sharing_r16()
{
  set(types::no_cot_sharing_r16);
}
cg_cot_sharing_r16_c::cot_sharing_r16_s_& cg_cot_sharing_r16_c::set_cot_sharing_r16()
{
  set(types::cot_sharing_r16);
  return c;
}
void cg_cot_sharing_r16_c::to_json(json_writer& j) const
{
  j.start_obj();
  switch (type_) {
    case types::no_cot_sharing_r16:
      break;
    case types::cot_sharing_r16:
      j.write_fieldname("cot-Sharing-r16");
      j.start_obj();
      j.write_int("duration-r16", c.dur_r16);
      j.write_int("offset-r16", c.offset_r16);
      j.write_int("channelAccessPriority-r16", c.ch_access_prio_r16);
      j.end_obj();
      break;
    default:
      log_invalid_choice_id(type_, "cg_cot_sharing_r16_c");
  }
  j.end_obj();
}
SRSASN_CODE cg_cot_sharing_r16_c::pack(bit_ref& bref) const
{
  type_.pack(bref);
  switch (type_) {
    case types::no_cot_sharing_r16:
      break;
    case types::cot_sharing_r16:
      HANDLE_CODE(pack_integer(bref, c.dur_r16, (uint8_t)1u, (uint8_t)39u));
      HANDLE_CODE(pack_integer(bref, c.offset_r16, (uint8_t)1u, (uint8_t)39u));
      HANDLE_CODE(pack_integer(bref, c.ch_access_prio_r16, (uint8_t)1u, (uint8_t)4u));
      break;
    default:
      log_invalid_choice_id(type_, "cg_cot_sharing_r16_c");
      return SRSASN_ERROR_ENCODE_FAIL;
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE cg_cot_sharing_r16_c::unpack(cbit_ref& bref)
{
  types e;
  e.unpack(bref);
  set(e);
  switch (type_) {
    case types::no_cot_sharing_r16:
      break;
    case types::cot_sharing_r16:
      HANDLE_CODE(unpack_integer(c.dur_r16, bref, (uint8_t)1u, (uint8_t)39u));
      HANDLE_CODE(unpack_integer(c.offset_r16, bref, (uint8_t)1u, (uint8_t)39u));
      HANDLE_CODE(unpack_integer(c.ch_access_prio_r16, bref, (uint8_t)1u, (uint8_t)4u));
      break;
    default:
      log_invalid_choice_id(type_, "cg_cot_sharing_r16_c");
      return SRSASN_ERROR_DECODE_FAIL;
  }
  return SRSASN_SUCCESS;
}

const char* cg_cot_sharing_r16_c::types_opts::to_string() const
{
  static const char* names[] = {"noCOT-Sharing-r16", "cot-Sharing-r16"};
  return convert_enum_idx(names, 2, value, "cg_cot_sharing_r16_c::types");
}

// CG-COT-Sharing-r17 ::= CHOICE
void cg_cot_sharing_r17_c::set(types::options e)
{
  type_ = e;
}
void cg_cot_sharing_r17_c::set_no_cot_sharing_r17()
{
  set(types::no_cot_sharing_r17);
}
cg_cot_sharing_r17_c::cot_sharing_r17_s_& cg_cot_sharing_r17_c::set_cot_sharing_r17()
{
  set(types::cot_sharing_r17);
  return c;
}
void cg_cot_sharing_r17_c::to_json(json_writer& j) const
{
  j.start_obj();
  switch (type_) {
    case types::no_cot_sharing_r17:
      break;
    case types::cot_sharing_r17:
      j.write_fieldname("cot-Sharing-r17");
      j.start_obj();
      j.write_int("duration-r17", c.dur_r17);
      j.write_int("offset-r17", c.offset_r17);
      j.end_obj();
      break;
    default:
      log_invalid_choice_id(type_, "cg_cot_sharing_r17_c");
  }
  j.end_obj();
}
SRSASN_CODE cg_cot_sharing_r17_c::pack(bit_ref& bref) const
{
  type_.pack(bref);
  switch (type_) {
    case types::no_cot_sharing_r17:
      break;
    case types::cot_sharing_r17:
      HANDLE_CODE(pack_integer(bref, c.dur_r17, (uint16_t)1u, (uint16_t)319u));
      HANDLE_CODE(pack_integer(bref, c.offset_r17, (uint16_t)1u, (uint16_t)319u));
      break;
    default:
      log_invalid_choice_id(type_, "cg_cot_sharing_r17_c");
      return SRSASN_ERROR_ENCODE_FAIL;
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE cg_cot_sharing_r17_c::unpack(cbit_ref& bref)
{
  types e;
  e.unpack(bref);
  set(e);
  switch (type_) {
    case types::no_cot_sharing_r17:
      break;
    case types::cot_sharing_r17:
      HANDLE_CODE(unpack_integer(c.dur_r17, bref, (uint16_t)1u, (uint16_t)319u));
      HANDLE_CODE(unpack_integer(c.offset_r17, bref, (uint16_t)1u, (uint16_t)319u));
      break;
    default:
      log_invalid_choice_id(type_, "cg_cot_sharing_r17_c");
      return SRSASN_ERROR_DECODE_FAIL;
  }
  return SRSASN_SUCCESS;
}

const char* cg_cot_sharing_r17_c::types_opts::to_string() const
{
  static const char* names[] = {"noCOT-Sharing-r17", "cot-Sharing-r17"};
  return convert_enum_idx(names, 2, value, "cg_cot_sharing_r17_c::types");
}

// CG-SDT-Configuration-r17 ::= SEQUENCE
SRSASN_CODE cg_sdt_cfg_r17_s::pack(bit_ref& bref) const
{
  HANDLE_CODE(bref.pack(cg_sdt_retx_timer_present, 1));
  HANDLE_CODE(bref.pack(sdt_ssb_subset_r17_present, 1));
  HANDLE_CODE(bref.pack(sdt_ssb_per_cg_pusch_r17_present, 1));
  HANDLE_CODE(bref.pack(sdt_p0_pusch_r17_present, 1));
  HANDLE_CODE(bref.pack(sdt_alpha_r17_present, 1));
  HANDLE_CODE(bref.pack(sdt_dmrs_ports_r17_present, 1));
  HANDLE_CODE(bref.pack(sdt_nrof_dmrs_seqs_r17_present, 1));

  if (cg_sdt_retx_timer_present) {
    HANDLE_CODE(pack_integer(bref, cg_sdt_retx_timer, (uint8_t)1u, (uint8_t)64u));
  }
  if (sdt_ssb_subset_r17_present) {
    HANDLE_CODE(sdt_ssb_subset_r17.pack(bref));
  }
  if (sdt_ssb_per_cg_pusch_r17_present) {
    HANDLE_CODE(sdt_ssb_per_cg_pusch_r17.pack(bref));
  }
  if (sdt_p0_pusch_r17_present) {
    HANDLE_CODE(pack_integer(bref, sdt_p0_pusch_r17, (int8_t)-16, (int8_t)15));
  }
  if (sdt_alpha_r17_present) {
    HANDLE_CODE(sdt_alpha_r17.pack(bref));
  }
  if (sdt_dmrs_ports_r17_present) {
    HANDLE_CODE(sdt_dmrs_ports_r17.pack(bref));
  }
  if (sdt_nrof_dmrs_seqs_r17_present) {
    HANDLE_CODE(pack_integer(bref, sdt_nrof_dmrs_seqs_r17, (uint8_t)1u, (uint8_t)2u));
  }

  return SRSASN_SUCCESS;
}
SRSASN_CODE cg_sdt_cfg_r17_s::unpack(cbit_ref& bref)
{
  HANDLE_CODE(bref.unpack(cg_sdt_retx_timer_present, 1));
  HANDLE_CODE(bref.unpack(sdt_ssb_subset_r17_present, 1));
  HANDLE_CODE(bref.unpack(sdt_ssb_per_cg_pusch_r17_present, 1));
  HANDLE_CODE(bref.unpack(sdt_p0_pusch_r17_present, 1));
  HANDLE_CODE(bref.unpack(sdt_alpha_r17_present, 1));
  HANDLE_CODE(bref.unpack(sdt_dmrs_ports_r17_present, 1));
  HANDLE_CODE(bref.unpack(sdt_nrof_dmrs_seqs_r17_present, 1));

  if (cg_sdt_retx_timer_present) {
    HANDLE_CODE(unpack_integer(cg_sdt_retx_timer, bref, (uint8_t)1u, (uint8_t)64u));
  }
  if (sdt_ssb_subset_r17_present) {
    HANDLE_CODE(sdt_ssb_subset_r17.unpack(bref));
  }
  if (sdt_ssb_per_cg_pusch_r17_present) {
    HANDLE_CODE(sdt_ssb_per_cg_pusch_r17.unpack(bref));
  }
  if (sdt_p0_pusch_r17_present) {
    HANDLE_CODE(unpack_integer(sdt_p0_pusch_r17, bref, (int8_t)-16, (int8_t)15));
  }
  if (sdt_alpha_r17_present) {
    HANDLE_CODE(sdt_alpha_r17.unpack(bref));
  }
  if (sdt_dmrs_ports_r17_present) {
    HANDLE_CODE(sdt_dmrs_ports_r17.unpack(bref));
  }
  if (sdt_nrof_dmrs_seqs_r17_present) {
    HANDLE_CODE(unpack_integer(sdt_nrof_dmrs_seqs_r17, bref, (uint8_t)1u, (uint8_t)2u));
  }

  return SRSASN_SUCCESS;
}
void cg_sdt_cfg_r17_s::to_json(json_writer& j) const
{
  j.start_obj();
  if (cg_sdt_retx_timer_present) {
    j.write_int("cg-SDT-RetransmissionTimer", cg_sdt_retx_timer);
  }
  if (sdt_ssb_subset_r17_present) {
    j.write_fieldname("sdt-SSB-Subset-r17");
    sdt_ssb_subset_r17.to_json(j);
  }
  if (sdt_ssb_per_cg_pusch_r17_present) {
    j.write_str("sdt-SSB-PerCG-PUSCH-r17", sdt_ssb_per_cg_pusch_r17.to_string());
  }
  if (sdt_p0_pusch_r17_present) {
    j.write_int("sdt-P0-PUSCH-r17", sdt_p0_pusch_r17);
  }
  if (sdt_alpha_r17_present) {
    j.write_str("sdt-Alpha-r17", sdt_alpha_r17.to_string());
  }
  if (sdt_dmrs_ports_r17_present) {
    j.write_fieldname("sdt-DMRS-Ports-r17");
    sdt_dmrs_ports_r17.to_json(j);
  }
  if (sdt_nrof_dmrs_seqs_r17_present) {
    j.write_int("sdt-NrofDMRS-Sequences-r17", sdt_nrof_dmrs_seqs_r17);
  }
  j.end_obj();
}

void cg_sdt_cfg_r17_s::sdt_ssb_subset_r17_c_::destroy_()
{
  switch (type_) {
    case types::short_bitmap_r17:
      c.destroy<fixed_bitstring<4>>();
      break;
    case types::medium_bitmap_r17:
      c.destroy<fixed_bitstring<8>>();
      break;
    case types::long_bitmap_r17:
      c.destroy<fixed_bitstring<64>>();
      break;
    default:
      break;
  }
}
void cg_sdt_cfg_r17_s::sdt_ssb_subset_r17_c_::set(types::options e)
{
  destroy_();
  type_ = e;
  switch (type_) {
    case types::short_bitmap_r17:
      c.init<fixed_bitstring<4>>();
      break;
    case types::medium_bitmap_r17:
      c.init<fixed_bitstring<8>>();
      break;
    case types::long_bitmap_r17:
      c.init<fixed_bitstring<64>>();
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "cg_sdt_cfg_r17_s::sdt_ssb_subset_r17_c_");
  }
}
cg_sdt_cfg_r17_s::sdt_ssb_subset_r17_c_::sdt_ssb_subset_r17_c_(const cg_sdt_cfg_r17_s::sdt_ssb_subset_r17_c_& other)
{
  type_ = other.type();
  switch (type_) {
    case types::short_bitmap_r17:
      c.init(other.c.get<fixed_bitstring<4>>());
      break;
    case types::medium_bitmap_r17:
      c.init(other.c.get<fixed_bitstring<8>>());
      break;
    case types::long_bitmap_r17:
      c.init(other.c.get<fixed_bitstring<64>>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "cg_sdt_cfg_r17_s::sdt_ssb_subset_r17_c_");
  }
}
cg_sdt_cfg_r17_s::sdt_ssb_subset_r17_c_&
cg_sdt_cfg_r17_s::sdt_ssb_subset_r17_c_::operator=(const cg_sdt_cfg_r17_s::sdt_ssb_subset_r17_c_& other)
{
  if (this == &other) {
    return *this;
  }
  set(other.type());
  switch (type_) {
    case types::short_bitmap_r17:
      c.set(other.c.get<fixed_bitstring<4>>());
      break;
    case types::medium_bitmap_r17:
      c.set(other.c.get<fixed_bitstring<8>>());
      break;
    case types::long_bitmap_r17:
      c.set(other.c.get<fixed_bitstring<64>>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "cg_sdt_cfg_r17_s::sdt_ssb_subset_r17_c_");
  }

  return *this;
}
fixed_bitstring<4>& cg_sdt_cfg_r17_s::sdt_ssb_subset_r17_c_::set_short_bitmap_r17()
{
  set(types::short_bitmap_r17);
  return c.get<fixed_bitstring<4>>();
}
fixed_bitstring<8>& cg_sdt_cfg_r17_s::sdt_ssb_subset_r17_c_::set_medium_bitmap_r17()
{
  set(types::medium_bitmap_r17);
  return c.get<fixed_bitstring<8>>();
}
fixed_bitstring<64>& cg_sdt_cfg_r17_s::sdt_ssb_subset_r17_c_::set_long_bitmap_r17()
{
  set(types::long_bitmap_r17);
  return c.get<fixed_bitstring<64>>();
}
void cg_sdt_cfg_r17_s::sdt_ssb_subset_r17_c_::to_json(json_writer& j) const
{
  j.start_obj();
  switch (type_) {
    case types::short_bitmap_r17:
      j.write_str("shortBitmap-r17", c.get<fixed_bitstring<4>>().to_string());
      break;
    case types::medium_bitmap_r17:
      j.write_str("mediumBitmap-r17", c.get<fixed_bitstring<8>>().to_string());
      break;
    case types::long_bitmap_r17:
      j.write_str("longBitmap-r17", c.get<fixed_bitstring<64>>().to_string());
      break;
    default:
      log_invalid_choice_id(type_, "cg_sdt_cfg_r17_s::sdt_ssb_subset_r17_c_");
  }
  j.end_obj();
}
SRSASN_CODE cg_sdt_cfg_r17_s::sdt_ssb_subset_r17_c_::pack(bit_ref& bref) const
{
  type_.pack(bref);
  switch (type_) {
    case types::short_bitmap_r17:
      HANDLE_CODE(c.get<fixed_bitstring<4>>().pack(bref));
      break;
    case types::medium_bitmap_r17:
      HANDLE_CODE(c.get<fixed_bitstring<8>>().pack(bref));
      break;
    case types::long_bitmap_r17:
      HANDLE_CODE(c.get<fixed_bitstring<64>>().pack(bref));
      break;
    default:
      log_invalid_choice_id(type_, "cg_sdt_cfg_r17_s::sdt_ssb_subset_r17_c_");
      return SRSASN_ERROR_ENCODE_FAIL;
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE cg_sdt_cfg_r17_s::sdt_ssb_subset_r17_c_::unpack(cbit_ref& bref)
{
  types e;
  e.unpack(bref);
  set(e);
  switch (type_) {
    case types::short_bitmap_r17:
      HANDLE_CODE(c.get<fixed_bitstring<4>>().unpack(bref));
      break;
    case types::medium_bitmap_r17:
      HANDLE_CODE(c.get<fixed_bitstring<8>>().unpack(bref));
      break;
    case types::long_bitmap_r17:
      HANDLE_CODE(c.get<fixed_bitstring<64>>().unpack(bref));
      break;
    default:
      log_invalid_choice_id(type_, "cg_sdt_cfg_r17_s::sdt_ssb_subset_r17_c_");
      return SRSASN_ERROR_DECODE_FAIL;
  }
  return SRSASN_SUCCESS;
}

const char* cg_sdt_cfg_r17_s::sdt_ssb_subset_r17_c_::types_opts::to_string() const
{
  static const char* names[] = {"shortBitmap-r17", "mediumBitmap-r17", "longBitmap-r17"};
  return convert_enum_idx(names, 3, value, "cg_sdt_cfg_r17_s::sdt_ssb_subset_r17_c_::types");
}

const char* cg_sdt_cfg_r17_s::sdt_ssb_per_cg_pusch_r17_opts::to_string() const
{
  static const char* names[] = {"oneEighth", "oneFourth", "half", "one", "two", "four", "eight", "sixteen"};
  return convert_enum_idx(names, 8, value, "cg_sdt_cfg_r17_s::sdt_ssb_per_cg_pusch_r17_e_");
}
float cg_sdt_cfg_r17_s::sdt_ssb_per_cg_pusch_r17_opts::to_number() const
{
  static const float numbers[] = {0.125, 0.25, 0.5, 1.0, 2.0, 4.0, 8.0, 6.0};
  return map_enum_number(numbers, 8, value, "cg_sdt_cfg_r17_s::sdt_ssb_per_cg_pusch_r17_e_");
}
const char* cg_sdt_cfg_r17_s::sdt_ssb_per_cg_pusch_r17_opts::to_number_string() const
{
  static const char* number_strs[] = {"1/8", "1/4", "0.5", "1", "2", "4", "8", "6"};
  return convert_enum_idx(number_strs, 8, value, "cg_sdt_cfg_r17_s::sdt_ssb_per_cg_pusch_r17_e_");
}

const char* cg_sdt_cfg_r17_s::sdt_alpha_r17_opts::to_string() const
{
  static const char* names[] = {"alpha0", "alpha04", "alpha05", "alpha06", "alpha07", "alpha08", "alpha09", "alpha1"};
  return convert_enum_idx(names, 8, value, "cg_sdt_cfg_r17_s::sdt_alpha_r17_e_");
}
float cg_sdt_cfg_r17_s::sdt_alpha_r17_opts::to_number() const
{
  static const float numbers[] = {0.0, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0};
  return map_enum_number(numbers, 8, value, "cg_sdt_cfg_r17_s::sdt_alpha_r17_e_");
}
const char* cg_sdt_cfg_r17_s::sdt_alpha_r17_opts::to_number_string() const
{
  static const char* number_strs[] = {"0", "0.4", "0.5", "0.6", "0.7", "0.8", "0.9", "1"};
  return convert_enum_idx(number_strs, 8, value, "cg_sdt_cfg_r17_s::sdt_alpha_r17_e_");
}

void cg_sdt_cfg_r17_s::sdt_dmrs_ports_r17_c_::destroy_()
{
  switch (type_) {
    case types::dmrs_type1_r17:
      c.destroy<fixed_bitstring<8>>();
      break;
    case types::dmrs_type2_r17:
      c.destroy<fixed_bitstring<12>>();
      break;
    default:
      break;
  }
}
void cg_sdt_cfg_r17_s::sdt_dmrs_ports_r17_c_::set(types::options e)
{
  destroy_();
  type_ = e;
  switch (type_) {
    case types::dmrs_type1_r17:
      c.init<fixed_bitstring<8>>();
      break;
    case types::dmrs_type2_r17:
      c.init<fixed_bitstring<12>>();
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "cg_sdt_cfg_r17_s::sdt_dmrs_ports_r17_c_");
  }
}
cg_sdt_cfg_r17_s::sdt_dmrs_ports_r17_c_::sdt_dmrs_ports_r17_c_(const cg_sdt_cfg_r17_s::sdt_dmrs_ports_r17_c_& other)
{
  type_ = other.type();
  switch (type_) {
    case types::dmrs_type1_r17:
      c.init(other.c.get<fixed_bitstring<8>>());
      break;
    case types::dmrs_type2_r17:
      c.init(other.c.get<fixed_bitstring<12>>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "cg_sdt_cfg_r17_s::sdt_dmrs_ports_r17_c_");
  }
}
cg_sdt_cfg_r17_s::sdt_dmrs_ports_r17_c_&
cg_sdt_cfg_r17_s::sdt_dmrs_ports_r17_c_::operator=(const cg_sdt_cfg_r17_s::sdt_dmrs_ports_r17_c_& other)
{
  if (this == &other) {
    return *this;
  }
  set(other.type());
  switch (type_) {
    case types::dmrs_type1_r17:
      c.set(other.c.get<fixed_bitstring<8>>());
      break;
    case types::dmrs_type2_r17:
      c.set(other.c.get<fixed_bitstring<12>>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "cg_sdt_cfg_r17_s::sdt_dmrs_ports_r17_c_");
  }

  return *this;
}
fixed_bitstring<8>& cg_sdt_cfg_r17_s::sdt_dmrs_ports_r17_c_::set_dmrs_type1_r17()
{
  set(types::dmrs_type1_r17);
  return c.get<fixed_bitstring<8>>();
}
fixed_bitstring<12>& cg_sdt_cfg_r17_s::sdt_dmrs_ports_r17_c_::set_dmrs_type2_r17()
{
  set(types::dmrs_type2_r17);
  return c.get<fixed_bitstring<12>>();
}
void cg_sdt_cfg_r17_s::sdt_dmrs_ports_r17_c_::to_json(json_writer& j) const
{
  j.start_obj();
  switch (type_) {
    case types::dmrs_type1_r17:
      j.write_str("dmrsType1-r17", c.get<fixed_bitstring<8>>().to_string());
      break;
    case types::dmrs_type2_r17:
      j.write_str("dmrsType2-r17", c.get<fixed_bitstring<12>>().to_string());
      break;
    default:
      log_invalid_choice_id(type_, "cg_sdt_cfg_r17_s::sdt_dmrs_ports_r17_c_");
  }
  j.end_obj();
}
SRSASN_CODE cg_sdt_cfg_r17_s::sdt_dmrs_ports_r17_c_::pack(bit_ref& bref) const
{
  type_.pack(bref);
  switch (type_) {
    case types::dmrs_type1_r17:
      HANDLE_CODE(c.get<fixed_bitstring<8>>().pack(bref));
      break;
    case types::dmrs_type2_r17:
      HANDLE_CODE(c.get<fixed_bitstring<12>>().pack(bref));
      break;
    default:
      log_invalid_choice_id(type_, "cg_sdt_cfg_r17_s::sdt_dmrs_ports_r17_c_");
      return SRSASN_ERROR_ENCODE_FAIL;
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE cg_sdt_cfg_r17_s::sdt_dmrs_ports_r17_c_::unpack(cbit_ref& bref)
{
  types e;
  e.unpack(bref);
  set(e);
  switch (type_) {
    case types::dmrs_type1_r17:
      HANDLE_CODE(c.get<fixed_bitstring<8>>().unpack(bref));
      break;
    case types::dmrs_type2_r17:
      HANDLE_CODE(c.get<fixed_bitstring<12>>().unpack(bref));
      break;
    default:
      log_invalid_choice_id(type_, "cg_sdt_cfg_r17_s::sdt_dmrs_ports_r17_c_");
      return SRSASN_ERROR_DECODE_FAIL;
  }
  return SRSASN_SUCCESS;
}

const char* cg_sdt_cfg_r17_s::sdt_dmrs_ports_r17_c_::types_opts::to_string() const
{
  static const char* names[] = {"dmrsType1-r17", "dmrsType2-r17"};
  return convert_enum_idx(names, 2, value, "cg_sdt_cfg_r17_s::sdt_dmrs_ports_r17_c_::types");
}
uint8_t cg_sdt_cfg_r17_s::sdt_dmrs_ports_r17_c_::types_opts::to_number() const
{
  static const uint8_t numbers[] = {1, 2};
  return map_enum_number(numbers, 2, value, "cg_sdt_cfg_r17_s::sdt_dmrs_ports_r17_c_::types");
}

// CG-StartingOffsets-r16 ::= SEQUENCE
SRSASN_CODE cg_start_offsets_r16_s::pack(bit_ref& bref) const
{
  HANDLE_CODE(bref.pack(cg_start_full_bw_inside_cot_r16.size() > 0, 1));
  HANDLE_CODE(bref.pack(cg_start_full_bw_outside_cot_r16.size() > 0, 1));
  HANDLE_CODE(bref.pack(cg_start_partial_bw_inside_cot_r16_present, 1));
  HANDLE_CODE(bref.pack(cg_start_partial_bw_outside_cot_r16_present, 1));

  if (cg_start_full_bw_inside_cot_r16.size() > 0) {
    HANDLE_CODE(pack_dyn_seq_of(bref, cg_start_full_bw_inside_cot_r16, 1, 7, integer_packer<uint8_t>(0, 6)));
  }
  if (cg_start_full_bw_outside_cot_r16.size() > 0) {
    HANDLE_CODE(pack_dyn_seq_of(bref, cg_start_full_bw_outside_cot_r16, 1, 7, integer_packer<uint8_t>(0, 6)));
  }
  if (cg_start_partial_bw_inside_cot_r16_present) {
    HANDLE_CODE(pack_integer(bref, cg_start_partial_bw_inside_cot_r16, (uint8_t)0u, (uint8_t)6u));
  }
  if (cg_start_partial_bw_outside_cot_r16_present) {
    HANDLE_CODE(pack_integer(bref, cg_start_partial_bw_outside_cot_r16, (uint8_t)0u, (uint8_t)6u));
  }

  return SRSASN_SUCCESS;
}
SRSASN_CODE cg_start_offsets_r16_s::unpack(cbit_ref& bref)
{
  bool cg_start_full_bw_inside_cot_r16_present;
  HANDLE_CODE(bref.unpack(cg_start_full_bw_inside_cot_r16_present, 1));
  bool cg_start_full_bw_outside_cot_r16_present;
  HANDLE_CODE(bref.unpack(cg_start_full_bw_outside_cot_r16_present, 1));
  HANDLE_CODE(bref.unpack(cg_start_partial_bw_inside_cot_r16_present, 1));
  HANDLE_CODE(bref.unpack(cg_start_partial_bw_outside_cot_r16_present, 1));

  if (cg_start_full_bw_inside_cot_r16_present) {
    HANDLE_CODE(unpack_dyn_seq_of(cg_start_full_bw_inside_cot_r16, bref, 1, 7, integer_packer<uint8_t>(0, 6)));
  }
  if (cg_start_full_bw_outside_cot_r16_present) {
    HANDLE_CODE(unpack_dyn_seq_of(cg_start_full_bw_outside_cot_r16, bref, 1, 7, integer_packer<uint8_t>(0, 6)));
  }
  if (cg_start_partial_bw_inside_cot_r16_present) {
    HANDLE_CODE(unpack_integer(cg_start_partial_bw_inside_cot_r16, bref, (uint8_t)0u, (uint8_t)6u));
  }
  if (cg_start_partial_bw_outside_cot_r16_present) {
    HANDLE_CODE(unpack_integer(cg_start_partial_bw_outside_cot_r16, bref, (uint8_t)0u, (uint8_t)6u));
  }

  return SRSASN_SUCCESS;
}
void cg_start_offsets_r16_s::to_json(json_writer& j) const
{
  j.start_obj();
  if (cg_start_full_bw_inside_cot_r16.size() > 0) {
    j.start_array("cg-StartingFullBW-InsideCOT-r16");
    for (const auto& e1 : cg_start_full_bw_inside_cot_r16) {
      j.write_int(e1);
    }
    j.end_array();
  }
  if (cg_start_full_bw_outside_cot_r16.size() > 0) {
    j.start_array("cg-StartingFullBW-OutsideCOT-r16");
    for (const auto& e1 : cg_start_full_bw_outside_cot_r16) {
      j.write_int(e1);
    }
    j.end_array();
  }
  if (cg_start_partial_bw_inside_cot_r16_present) {
    j.write_int("cg-StartingPartialBW-InsideCOT-r16", cg_start_partial_bw_inside_cot_r16);
  }
  if (cg_start_partial_bw_outside_cot_r16_present) {
    j.write_int("cg-StartingPartialBW-OutsideCOT-r16", cg_start_partial_bw_outside_cot_r16);
  }
  j.end_obj();
}

// CG-UCI-OnPUSCH ::= CHOICE
void cg_uci_on_pusch_c::destroy_()
{
  switch (type_) {
    case types::dyn:
      c.destroy<dyn_l_>();
      break;
    case types::semi_static:
      c.destroy<beta_offsets_s>();
      break;
    default:
      break;
  }
}
void cg_uci_on_pusch_c::set(types::options e)
{
  destroy_();
  type_ = e;
  switch (type_) {
    case types::dyn:
      c.init<dyn_l_>();
      break;
    case types::semi_static:
      c.init<beta_offsets_s>();
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "cg_uci_on_pusch_c");
  }
}
cg_uci_on_pusch_c::cg_uci_on_pusch_c(const cg_uci_on_pusch_c& other)
{
  type_ = other.type();
  switch (type_) {
    case types::dyn:
      c.init(other.c.get<dyn_l_>());
      break;
    case types::semi_static:
      c.init(other.c.get<beta_offsets_s>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "cg_uci_on_pusch_c");
  }
}
cg_uci_on_pusch_c& cg_uci_on_pusch_c::operator=(const cg_uci_on_pusch_c& other)
{
  if (this == &other) {
    return *this;
  }
  set(other.type());
  switch (type_) {
    case types::dyn:
      c.set(other.c.get<dyn_l_>());
      break;
    case types::semi_static:
      c.set(other.c.get<beta_offsets_s>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "cg_uci_on_pusch_c");
  }

  return *this;
}
cg_uci_on_pusch_c::dyn_l_& cg_uci_on_pusch_c::set_dyn()
{
  set(types::dyn);
  return c.get<dyn_l_>();
}
beta_offsets_s& cg_uci_on_pusch_c::set_semi_static()
{
  set(types::semi_static);
  return c.get<beta_offsets_s>();
}
void cg_uci_on_pusch_c::to_json(json_writer& j) const
{
  j.start_obj();
  switch (type_) {
    case types::dyn:
      j.start_array("dynamic");
      for (const auto& e1 : c.get<dyn_l_>()) {
        e1.to_json(j);
      }
      j.end_array();
      break;
    case types::semi_static:
      j.write_fieldname("semiStatic");
      c.get<beta_offsets_s>().to_json(j);
      break;
    default:
      log_invalid_choice_id(type_, "cg_uci_on_pusch_c");
  }
  j.end_obj();
}
SRSASN_CODE cg_uci_on_pusch_c::pack(bit_ref& bref) const
{
  type_.pack(bref);
  switch (type_) {
    case types::dyn:
      HANDLE_CODE(pack_dyn_seq_of(bref, c.get<dyn_l_>(), 1, 4));
      break;
    case types::semi_static:
      HANDLE_CODE(c.get<beta_offsets_s>().pack(bref));
      break;
    default:
      log_invalid_choice_id(type_, "cg_uci_on_pusch_c");
      return SRSASN_ERROR_ENCODE_FAIL;
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE cg_uci_on_pusch_c::unpack(cbit_ref& bref)
{
  types e;
  e.unpack(bref);
  set(e);
  switch (type_) {
    case types::dyn:
      HANDLE_CODE(unpack_dyn_seq_of(c.get<dyn_l_>(), bref, 1, 4));
      break;
    case types::semi_static:
      HANDLE_CODE(c.get<beta_offsets_s>().unpack(bref));
      break;
    default:
      log_invalid_choice_id(type_, "cg_uci_on_pusch_c");
      return SRSASN_ERROR_DECODE_FAIL;
  }
  return SRSASN_SUCCESS;
}

const char* cg_uci_on_pusch_c::types_opts::to_string() const
{
  static const char* names[] = {"dynamic", "semiStatic"};
  return convert_enum_idx(names, 2, value, "cg_uci_on_pusch_c::types");
}

// DMRS-BundlingPUCCH-Config-r17 ::= SEQUENCE
SRSASN_CODE dmrs_bundling_pucch_cfg_r17_s::pack(bit_ref& bref) const
{
  bref.pack(ext, 1);
  HANDLE_CODE(bref.pack(pucch_dmrs_bundling_r17_present, 1));
  HANDLE_CODE(bref.pack(pucch_time_domain_win_len_r17_present, 1));
  HANDLE_CODE(bref.pack(pucch_win_restart_r17_present, 1));
  HANDLE_CODE(bref.pack(pucch_freq_hop_interv_r17_present, 1));

  if (pucch_time_domain_win_len_r17_present) {
    HANDLE_CODE(pack_integer(bref, pucch_time_domain_win_len_r17, (uint8_t)2u, (uint8_t)8u));
  }
  if (pucch_freq_hop_interv_r17_present) {
    HANDLE_CODE(pucch_freq_hop_interv_r17.pack(bref));
  }

  return SRSASN_SUCCESS;
}
SRSASN_CODE dmrs_bundling_pucch_cfg_r17_s::unpack(cbit_ref& bref)
{
  bref.unpack(ext, 1);
  HANDLE_CODE(bref.unpack(pucch_dmrs_bundling_r17_present, 1));
  HANDLE_CODE(bref.unpack(pucch_time_domain_win_len_r17_present, 1));
  HANDLE_CODE(bref.unpack(pucch_win_restart_r17_present, 1));
  HANDLE_CODE(bref.unpack(pucch_freq_hop_interv_r17_present, 1));

  if (pucch_time_domain_win_len_r17_present) {
    HANDLE_CODE(unpack_integer(pucch_time_domain_win_len_r17, bref, (uint8_t)2u, (uint8_t)8u));
  }
  if (pucch_freq_hop_interv_r17_present) {
    HANDLE_CODE(pucch_freq_hop_interv_r17.unpack(bref));
  }

  return SRSASN_SUCCESS;
}
void dmrs_bundling_pucch_cfg_r17_s::to_json(json_writer& j) const
{
  j.start_obj();
  if (pucch_dmrs_bundling_r17_present) {
    j.write_str("pucch-DMRS-Bundling-r17", "enabled");
  }
  if (pucch_time_domain_win_len_r17_present) {
    j.write_int("pucch-TimeDomainWindowLength-r17", pucch_time_domain_win_len_r17);
  }
  if (pucch_win_restart_r17_present) {
    j.write_str("pucch-WindowRestart-r17", "enabled");
  }
  if (pucch_freq_hop_interv_r17_present) {
    j.write_str("pucch-FrequencyHoppingInterval-r17", pucch_freq_hop_interv_r17.to_string());
  }
  j.end_obj();
}

const char* dmrs_bundling_pucch_cfg_r17_s::pucch_freq_hop_interv_r17_opts::to_string() const
{
  static const char* names[] = {"s2", "s4", "s5", "s10"};
  return convert_enum_idx(names, 4, value, "dmrs_bundling_pucch_cfg_r17_s::pucch_freq_hop_interv_r17_e_");
}
uint8_t dmrs_bundling_pucch_cfg_r17_s::pucch_freq_hop_interv_r17_opts::to_number() const
{
  static const uint8_t numbers[] = {2, 4, 5, 10};
  return map_enum_number(numbers, 4, value, "dmrs_bundling_pucch_cfg_r17_s::pucch_freq_hop_interv_r17_e_");
}

// DMRS-UplinkConfig ::= SEQUENCE
SRSASN_CODE dmrs_ul_cfg_s::pack(bit_ref& bref) const
{
  bref.pack(ext, 1);
  HANDLE_CODE(bref.pack(dmrs_type_present, 1));
  HANDLE_CODE(bref.pack(dmrs_add_position_present, 1));
  HANDLE_CODE(bref.pack(phase_tracking_rs_present, 1));
  HANDLE_CODE(bref.pack(max_len_present, 1));
  HANDLE_CODE(bref.pack(transform_precoding_disabled_present, 1));
  HANDLE_CODE(bref.pack(transform_precoding_enabled_present, 1));

  if (dmrs_add_position_present) {
    HANDLE_CODE(dmrs_add_position.pack(bref));
  }
  if (phase_tracking_rs_present) {
    HANDLE_CODE(phase_tracking_rs.pack(bref));
  }
  if (transform_precoding_disabled_present) {
    HANDLE_CODE(transform_precoding_disabled.pack(bref));
  }
  if (transform_precoding_enabled_present) {
    HANDLE_CODE(transform_precoding_enabled.pack(bref));
  }

  return SRSASN_SUCCESS;
}
SRSASN_CODE dmrs_ul_cfg_s::unpack(cbit_ref& bref)
{
  bref.unpack(ext, 1);
  HANDLE_CODE(bref.unpack(dmrs_type_present, 1));
  HANDLE_CODE(bref.unpack(dmrs_add_position_present, 1));
  HANDLE_CODE(bref.unpack(phase_tracking_rs_present, 1));
  HANDLE_CODE(bref.unpack(max_len_present, 1));
  HANDLE_CODE(bref.unpack(transform_precoding_disabled_present, 1));
  HANDLE_CODE(bref.unpack(transform_precoding_enabled_present, 1));

  if (dmrs_add_position_present) {
    HANDLE_CODE(dmrs_add_position.unpack(bref));
  }
  if (phase_tracking_rs_present) {
    HANDLE_CODE(phase_tracking_rs.unpack(bref));
  }
  if (transform_precoding_disabled_present) {
    HANDLE_CODE(transform_precoding_disabled.unpack(bref));
  }
  if (transform_precoding_enabled_present) {
    HANDLE_CODE(transform_precoding_enabled.unpack(bref));
  }

  return SRSASN_SUCCESS;
}
void dmrs_ul_cfg_s::to_json(json_writer& j) const
{
  j.start_obj();
  if (dmrs_type_present) {
    j.write_str("dmrs-Type", "type2");
  }
  if (dmrs_add_position_present) {
    j.write_str("dmrs-AdditionalPosition", dmrs_add_position.to_string());
  }
  if (phase_tracking_rs_present) {
    j.write_fieldname("phaseTrackingRS");
    phase_tracking_rs.to_json(j);
  }
  if (max_len_present) {
    j.write_str("maxLength", "len2");
  }
  if (transform_precoding_disabled_present) {
    j.write_fieldname("transformPrecodingDisabled");
    transform_precoding_disabled.to_json(j);
  }
  if (transform_precoding_enabled_present) {
    j.write_fieldname("transformPrecodingEnabled");
    transform_precoding_enabled.to_json(j);
  }
  j.end_obj();
}

const char* dmrs_ul_cfg_s::dmrs_add_position_opts::to_string() const
{
  static const char* names[] = {"pos0", "pos1", "pos3"};
  return convert_enum_idx(names, 3, value, "dmrs_ul_cfg_s::dmrs_add_position_e_");
}
uint8_t dmrs_ul_cfg_s::dmrs_add_position_opts::to_number() const
{
  static const uint8_t numbers[] = {0, 1, 3};
  return map_enum_number(numbers, 3, value, "dmrs_ul_cfg_s::dmrs_add_position_e_");
}

SRSASN_CODE dmrs_ul_cfg_s::transform_precoding_disabled_s_::pack(bit_ref& bref) const
{
  bref.pack(ext, 1);
  HANDLE_CODE(bref.pack(scrambling_id0_present, 1));
  HANDLE_CODE(bref.pack(scrambling_id1_present, 1));

  if (scrambling_id0_present) {
    HANDLE_CODE(pack_integer(bref, scrambling_id0, (uint32_t)0u, (uint32_t)65535u));
  }
  if (scrambling_id1_present) {
    HANDLE_CODE(pack_integer(bref, scrambling_id1, (uint32_t)0u, (uint32_t)65535u));
  }

  if (ext) {
    ext_groups_packer_guard group_flags;
    group_flags[0] |= dmrs_ul_r16_present;
    group_flags.pack(bref);

    if (group_flags[0]) {
      varlength_field_pack_guard varlen_scope(bref, false);

      HANDLE_CODE(bref.pack(dmrs_ul_r16_present, 1));
    }
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE dmrs_ul_cfg_s::transform_precoding_disabled_s_::unpack(cbit_ref& bref)
{
  bref.unpack(ext, 1);
  HANDLE_CODE(bref.unpack(scrambling_id0_present, 1));
  HANDLE_CODE(bref.unpack(scrambling_id1_present, 1));

  if (scrambling_id0_present) {
    HANDLE_CODE(unpack_integer(scrambling_id0, bref, (uint32_t)0u, (uint32_t)65535u));
  }
  if (scrambling_id1_present) {
    HANDLE_CODE(unpack_integer(scrambling_id1, bref, (uint32_t)0u, (uint32_t)65535u));
  }

  if (ext) {
    ext_groups_unpacker_guard group_flags(1);
    group_flags.unpack(bref);

    if (group_flags[0]) {
      varlength_field_unpack_guard varlen_scope(bref, false);

      HANDLE_CODE(bref.unpack(dmrs_ul_r16_present, 1));
    }
  }
  return SRSASN_SUCCESS;
}
void dmrs_ul_cfg_s::transform_precoding_disabled_s_::to_json(json_writer& j) const
{
  j.start_obj();
  if (scrambling_id0_present) {
    j.write_int("scramblingID0", scrambling_id0);
  }
  if (scrambling_id1_present) {
    j.write_int("scramblingID1", scrambling_id1);
  }
  if (ext) {
    if (dmrs_ul_r16_present) {
      j.write_str("dmrs-Uplink-r16", "enabled");
    }
  }
  j.end_obj();
}

SRSASN_CODE dmrs_ul_cfg_s::transform_precoding_enabled_s_::pack(bit_ref& bref) const
{
  bref.pack(ext, 1);
  HANDLE_CODE(bref.pack(npusch_id_present, 1));
  HANDLE_CODE(bref.pack(seq_group_hop_present, 1));
  HANDLE_CODE(bref.pack(seq_hop_present, 1));

  if (npusch_id_present) {
    HANDLE_CODE(pack_integer(bref, npusch_id, (uint16_t)0u, (uint16_t)1007u));
  }

  if (ext) {
    ext_groups_packer_guard group_flags;
    group_flags[0] |= dmrs_ul_transform_precoding_r16.is_present();
    group_flags.pack(bref);

    if (group_flags[0]) {
      varlength_field_pack_guard varlen_scope(bref, false);

      HANDLE_CODE(bref.pack(dmrs_ul_transform_precoding_r16.is_present(), 1));
      if (dmrs_ul_transform_precoding_r16.is_present()) {
        HANDLE_CODE(dmrs_ul_transform_precoding_r16->pack(bref));
      }
    }
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE dmrs_ul_cfg_s::transform_precoding_enabled_s_::unpack(cbit_ref& bref)
{
  bref.unpack(ext, 1);
  HANDLE_CODE(bref.unpack(npusch_id_present, 1));
  HANDLE_CODE(bref.unpack(seq_group_hop_present, 1));
  HANDLE_CODE(bref.unpack(seq_hop_present, 1));

  if (npusch_id_present) {
    HANDLE_CODE(unpack_integer(npusch_id, bref, (uint16_t)0u, (uint16_t)1007u));
  }

  if (ext) {
    ext_groups_unpacker_guard group_flags(1);
    group_flags.unpack(bref);

    if (group_flags[0]) {
      varlength_field_unpack_guard varlen_scope(bref, false);

      unpack_presence_flag(dmrs_ul_transform_precoding_r16, bref);
      if (dmrs_ul_transform_precoding_r16.is_present()) {
        HANDLE_CODE(dmrs_ul_transform_precoding_r16->unpack(bref));
      }
    }
  }
  return SRSASN_SUCCESS;
}
void dmrs_ul_cfg_s::transform_precoding_enabled_s_::to_json(json_writer& j) const
{
  j.start_obj();
  if (npusch_id_present) {
    j.write_int("nPUSCH-Identity", npusch_id);
  }
  if (seq_group_hop_present) {
    j.write_str("sequenceGroupHopping", "disabled");
  }
  if (seq_hop_present) {
    j.write_str("sequenceHopping", "enabled");
  }
  if (ext) {
    if (dmrs_ul_transform_precoding_r16.is_present()) {
      j.write_fieldname("dmrs-UplinkTransformPrecoding-r16");
      dmrs_ul_transform_precoding_r16->to_json(j);
    }
  }
  j.end_obj();
}

// DummyPathlossReferenceRS-v1710 ::= SEQUENCE
SRSASN_CODE dummy_pathloss_ref_rs_v1710_s::pack(bit_ref& bref) const
{
  HANDLE_CODE(bref.pack(add_pci_r17_present, 1));

  HANDLE_CODE(pack_integer(bref, pusch_pathloss_ref_rs_id_r17, (uint8_t)0u, (uint8_t)63u));
  if (add_pci_r17_present) {
    HANDLE_CODE(pack_integer(bref, add_pci_r17, (uint8_t)1u, (uint8_t)7u));
  }

  return SRSASN_SUCCESS;
}
SRSASN_CODE dummy_pathloss_ref_rs_v1710_s::unpack(cbit_ref& bref)
{
  HANDLE_CODE(bref.unpack(add_pci_r17_present, 1));

  HANDLE_CODE(unpack_integer(pusch_pathloss_ref_rs_id_r17, bref, (uint8_t)0u, (uint8_t)63u));
  if (add_pci_r17_present) {
    HANDLE_CODE(unpack_integer(add_pci_r17, bref, (uint8_t)1u, (uint8_t)7u));
  }

  return SRSASN_SUCCESS;
}
void dummy_pathloss_ref_rs_v1710_s::to_json(json_writer& j) const
{
  j.start_obj();
  j.write_int("pusch-PathlossReferenceRS-Id-r17", pusch_pathloss_ref_rs_id_r17);
  if (add_pci_r17_present) {
    j.write_int("additionalPCI-r17", add_pci_r17);
  }
  j.end_obj();
}

// P0-PUSCH-AlphaSet ::= SEQUENCE
SRSASN_CODE p0_pusch_alpha_set_s::pack(bit_ref& bref) const
{
  HANDLE_CODE(bref.pack(p0_present, 1));
  HANDLE_CODE(bref.pack(alpha_present, 1));

  HANDLE_CODE(pack_integer(bref, p0_pusch_alpha_set_id, (uint8_t)0u, (uint8_t)29u));
  if (p0_present) {
    HANDLE_CODE(pack_integer(bref, p0, (int8_t)-16, (int8_t)15));
  }
  if (alpha_present) {
    HANDLE_CODE(alpha.pack(bref));
  }

  return SRSASN_SUCCESS;
}
SRSASN_CODE p0_pusch_alpha_set_s::unpack(cbit_ref& bref)
{
  HANDLE_CODE(bref.unpack(p0_present, 1));
  HANDLE_CODE(bref.unpack(alpha_present, 1));

  HANDLE_CODE(unpack_integer(p0_pusch_alpha_set_id, bref, (uint8_t)0u, (uint8_t)29u));
  if (p0_present) {
    HANDLE_CODE(unpack_integer(p0, bref, (int8_t)-16, (int8_t)15));
  }
  if (alpha_present) {
    HANDLE_CODE(alpha.unpack(bref));
  }

  return SRSASN_SUCCESS;
}
void p0_pusch_alpha_set_s::to_json(json_writer& j) const
{
  j.start_obj();
  j.write_int("p0-PUSCH-AlphaSetId", p0_pusch_alpha_set_id);
  if (p0_present) {
    j.write_int("p0", p0);
  }
  if (alpha_present) {
    j.write_str("alpha", alpha.to_string());
  }
  j.end_obj();
}

// P0-PUSCH-Set-r16 ::= SEQUENCE
SRSASN_CODE p0_pusch_set_r16_s::pack(bit_ref& bref) const
{
  bref.pack(ext, 1);
  HANDLE_CODE(bref.pack(p0_list_r16.size() > 0, 1));

  HANDLE_CODE(pack_integer(bref, p0_pusch_set_id_r16, (uint8_t)0u, (uint8_t)15u));
  if (p0_list_r16.size() > 0) {
    HANDLE_CODE(pack_dyn_seq_of(bref, p0_list_r16, 1, 2, integer_packer<int8_t>(-16, 15)));
  }

  return SRSASN_SUCCESS;
}
SRSASN_CODE p0_pusch_set_r16_s::unpack(cbit_ref& bref)
{
  bref.unpack(ext, 1);
  bool p0_list_r16_present;
  HANDLE_CODE(bref.unpack(p0_list_r16_present, 1));

  HANDLE_CODE(unpack_integer(p0_pusch_set_id_r16, bref, (uint8_t)0u, (uint8_t)15u));
  if (p0_list_r16_present) {
    HANDLE_CODE(unpack_dyn_seq_of(p0_list_r16, bref, 1, 2, integer_packer<int8_t>(-16, 15)));
  }

  return SRSASN_SUCCESS;
}
void p0_pusch_set_r16_s::to_json(json_writer& j) const
{
  j.start_obj();
  j.write_int("p0-PUSCH-SetId-r16", p0_pusch_set_id_r16);
  if (p0_list_r16.size() > 0) {
    j.start_array("p0-List-r16");
    for (const auto& e1 : p0_list_r16) {
      j.write_int(e1);
    }
    j.end_array();
  }
  j.end_obj();
}

// PRACH-ResourceDedicatedBFR ::= CHOICE
void prach_res_ded_bfr_c::destroy_()
{
  switch (type_) {
    case types::ssb:
      c.destroy<bfr_ssb_res_s>();
      break;
    case types::csi_rs:
      c.destroy<bfr_csi_rs_res_s>();
      break;
    default:
      break;
  }
}
void prach_res_ded_bfr_c::set(types::options e)
{
  destroy_();
  type_ = e;
  switch (type_) {
    case types::ssb:
      c.init<bfr_ssb_res_s>();
      break;
    case types::csi_rs:
      c.init<bfr_csi_rs_res_s>();
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "prach_res_ded_bfr_c");
  }
}
prach_res_ded_bfr_c::prach_res_ded_bfr_c(const prach_res_ded_bfr_c& other)
{
  type_ = other.type();
  switch (type_) {
    case types::ssb:
      c.init(other.c.get<bfr_ssb_res_s>());
      break;
    case types::csi_rs:
      c.init(other.c.get<bfr_csi_rs_res_s>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "prach_res_ded_bfr_c");
  }
}
prach_res_ded_bfr_c& prach_res_ded_bfr_c::operator=(const prach_res_ded_bfr_c& other)
{
  if (this == &other) {
    return *this;
  }
  set(other.type());
  switch (type_) {
    case types::ssb:
      c.set(other.c.get<bfr_ssb_res_s>());
      break;
    case types::csi_rs:
      c.set(other.c.get<bfr_csi_rs_res_s>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "prach_res_ded_bfr_c");
  }

  return *this;
}
bfr_ssb_res_s& prach_res_ded_bfr_c::set_ssb()
{
  set(types::ssb);
  return c.get<bfr_ssb_res_s>();
}
bfr_csi_rs_res_s& prach_res_ded_bfr_c::set_csi_rs()
{
  set(types::csi_rs);
  return c.get<bfr_csi_rs_res_s>();
}
void prach_res_ded_bfr_c::to_json(json_writer& j) const
{
  j.start_obj();
  switch (type_) {
    case types::ssb:
      j.write_fieldname("ssb");
      c.get<bfr_ssb_res_s>().to_json(j);
      break;
    case types::csi_rs:
      j.write_fieldname("csi-RS");
      c.get<bfr_csi_rs_res_s>().to_json(j);
      break;
    default:
      log_invalid_choice_id(type_, "prach_res_ded_bfr_c");
  }
  j.end_obj();
}
SRSASN_CODE prach_res_ded_bfr_c::pack(bit_ref& bref) const
{
  type_.pack(bref);
  switch (type_) {
    case types::ssb:
      HANDLE_CODE(c.get<bfr_ssb_res_s>().pack(bref));
      break;
    case types::csi_rs:
      HANDLE_CODE(c.get<bfr_csi_rs_res_s>().pack(bref));
      break;
    default:
      log_invalid_choice_id(type_, "prach_res_ded_bfr_c");
      return SRSASN_ERROR_ENCODE_FAIL;
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE prach_res_ded_bfr_c::unpack(cbit_ref& bref)
{
  types e;
  e.unpack(bref);
  set(e);
  switch (type_) {
    case types::ssb:
      HANDLE_CODE(c.get<bfr_ssb_res_s>().unpack(bref));
      break;
    case types::csi_rs:
      HANDLE_CODE(c.get<bfr_csi_rs_res_s>().unpack(bref));
      break;
    default:
      log_invalid_choice_id(type_, "prach_res_ded_bfr_c");
      return SRSASN_ERROR_DECODE_FAIL;
  }
  return SRSASN_SUCCESS;
}

const char* prach_res_ded_bfr_c::types_opts::to_string() const
{
  static const char* names[] = {"ssb", "csi-RS"};
  return convert_enum_idx(names, 2, value, "prach_res_ded_bfr_c::types");
}

// PUCCH-FormatConfig ::= SEQUENCE
SRSASN_CODE pucch_format_cfg_s::pack(bit_ref& bref) const
{
  HANDLE_CODE(bref.pack(interslot_freq_hop_present, 1));
  HANDLE_CODE(bref.pack(add_dmrs_present, 1));
  HANDLE_CODE(bref.pack(max_code_rate_present, 1));
  HANDLE_CODE(bref.pack(nrof_slots_present, 1));
  HANDLE_CODE(bref.pack(pi2_bpsk_present, 1));
  HANDLE_CODE(bref.pack(simul_harq_ack_csi_present, 1));

  if (max_code_rate_present) {
    HANDLE_CODE(max_code_rate.pack(bref));
  }
  if (nrof_slots_present) {
    HANDLE_CODE(nrof_slots.pack(bref));
  }

  return SRSASN_SUCCESS;
}
SRSASN_CODE pucch_format_cfg_s::unpack(cbit_ref& bref)
{
  HANDLE_CODE(bref.unpack(interslot_freq_hop_present, 1));
  HANDLE_CODE(bref.unpack(add_dmrs_present, 1));
  HANDLE_CODE(bref.unpack(max_code_rate_present, 1));
  HANDLE_CODE(bref.unpack(nrof_slots_present, 1));
  HANDLE_CODE(bref.unpack(pi2_bpsk_present, 1));
  HANDLE_CODE(bref.unpack(simul_harq_ack_csi_present, 1));

  if (max_code_rate_present) {
    HANDLE_CODE(max_code_rate.unpack(bref));
  }
  if (nrof_slots_present) {
    HANDLE_CODE(nrof_slots.unpack(bref));
  }

  return SRSASN_SUCCESS;
}
void pucch_format_cfg_s::to_json(json_writer& j) const
{
  j.start_obj();
  if (interslot_freq_hop_present) {
    j.write_str("interslotFrequencyHopping", "enabled");
  }
  if (add_dmrs_present) {
    j.write_str("additionalDMRS", "true");
  }
  if (max_code_rate_present) {
    j.write_str("maxCodeRate", max_code_rate.to_string());
  }
  if (nrof_slots_present) {
    j.write_str("nrofSlots", nrof_slots.to_string());
  }
  if (pi2_bpsk_present) {
    j.write_str("pi2BPSK", "enabled");
  }
  if (simul_harq_ack_csi_present) {
    j.write_str("simultaneousHARQ-ACK-CSI", "true");
  }
  j.end_obj();
}

const char* pucch_format_cfg_s::nrof_slots_opts::to_string() const
{
  static const char* names[] = {"n2", "n4", "n8"};
  return convert_enum_idx(names, 3, value, "pucch_format_cfg_s::nrof_slots_e_");
}
uint8_t pucch_format_cfg_s::nrof_slots_opts::to_number() const
{
  static const uint8_t numbers[] = {2, 4, 8};
  return map_enum_number(numbers, 3, value, "pucch_format_cfg_s::nrof_slots_e_");
}

// PUCCH-FormatConfigExt-r17 ::= SEQUENCE
SRSASN_CODE pucch_format_cfg_ext_r17_s::pack(bit_ref& bref) const
{
  bref.pack(ext, 1);
  HANDLE_CODE(bref.pack(max_code_rate_lp_r17_present, 1));

  if (max_code_rate_lp_r17_present) {
    HANDLE_CODE(max_code_rate_lp_r17.pack(bref));
  }

  return SRSASN_SUCCESS;
}
SRSASN_CODE pucch_format_cfg_ext_r17_s::unpack(cbit_ref& bref)
{
  bref.unpack(ext, 1);
  HANDLE_CODE(bref.unpack(max_code_rate_lp_r17_present, 1));

  if (max_code_rate_lp_r17_present) {
    HANDLE_CODE(max_code_rate_lp_r17.unpack(bref));
  }

  return SRSASN_SUCCESS;
}
void pucch_format_cfg_ext_r17_s::to_json(json_writer& j) const
{
  j.start_obj();
  if (max_code_rate_lp_r17_present) {
    j.write_str("maxCodeRateLP-r17", max_code_rate_lp_r17.to_string());
  }
  j.end_obj();
}

// PUCCH-PowerControl ::= SEQUENCE
SRSASN_CODE pucch_pwr_ctrl_s::pack(bit_ref& bref) const
{
  bref.pack(ext, 1);
  HANDLE_CODE(bref.pack(delta_f_pucch_f0_present, 1));
  HANDLE_CODE(bref.pack(delta_f_pucch_f1_present, 1));
  HANDLE_CODE(bref.pack(delta_f_pucch_f2_present, 1));
  HANDLE_CODE(bref.pack(delta_f_pucch_f3_present, 1));
  HANDLE_CODE(bref.pack(delta_f_pucch_f4_present, 1));
  HANDLE_CODE(bref.pack(p0_set.size() > 0, 1));
  HANDLE_CODE(bref.pack(pathloss_ref_rss.size() > 0, 1));
  HANDLE_CODE(bref.pack(two_pucch_pc_adjustment_states_present, 1));

  if (delta_f_pucch_f0_present) {
    HANDLE_CODE(pack_integer(bref, delta_f_pucch_f0, (int8_t)-16, (int8_t)15));
  }
  if (delta_f_pucch_f1_present) {
    HANDLE_CODE(pack_integer(bref, delta_f_pucch_f1, (int8_t)-16, (int8_t)15));
  }
  if (delta_f_pucch_f2_present) {
    HANDLE_CODE(pack_integer(bref, delta_f_pucch_f2, (int8_t)-16, (int8_t)15));
  }
  if (delta_f_pucch_f3_present) {
    HANDLE_CODE(pack_integer(bref, delta_f_pucch_f3, (int8_t)-16, (int8_t)15));
  }
  if (delta_f_pucch_f4_present) {
    HANDLE_CODE(pack_integer(bref, delta_f_pucch_f4, (int8_t)-16, (int8_t)15));
  }
  if (p0_set.size() > 0) {
    HANDLE_CODE(pack_dyn_seq_of(bref, p0_set, 1, 8));
  }
  if (pathloss_ref_rss.size() > 0) {
    HANDLE_CODE(pack_dyn_seq_of(bref, pathloss_ref_rss, 1, 4));
  }

  if (ext) {
    ext_groups_packer_guard group_flags;
    group_flags[0] |= pathloss_ref_rss_v1610.is_present();
    group_flags.pack(bref);

    if (group_flags[0]) {
      varlength_field_pack_guard varlen_scope(bref, false);

      HANDLE_CODE(bref.pack(pathloss_ref_rss_v1610.is_present(), 1));
      if (pathloss_ref_rss_v1610.is_present()) {
        HANDLE_CODE(pathloss_ref_rss_v1610->pack(bref));
      }
    }
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE pucch_pwr_ctrl_s::unpack(cbit_ref& bref)
{
  bref.unpack(ext, 1);
  HANDLE_CODE(bref.unpack(delta_f_pucch_f0_present, 1));
  HANDLE_CODE(bref.unpack(delta_f_pucch_f1_present, 1));
  HANDLE_CODE(bref.unpack(delta_f_pucch_f2_present, 1));
  HANDLE_CODE(bref.unpack(delta_f_pucch_f3_present, 1));
  HANDLE_CODE(bref.unpack(delta_f_pucch_f4_present, 1));
  bool p0_set_present;
  HANDLE_CODE(bref.unpack(p0_set_present, 1));
  bool pathloss_ref_rss_present;
  HANDLE_CODE(bref.unpack(pathloss_ref_rss_present, 1));
  HANDLE_CODE(bref.unpack(two_pucch_pc_adjustment_states_present, 1));

  if (delta_f_pucch_f0_present) {
    HANDLE_CODE(unpack_integer(delta_f_pucch_f0, bref, (int8_t)-16, (int8_t)15));
  }
  if (delta_f_pucch_f1_present) {
    HANDLE_CODE(unpack_integer(delta_f_pucch_f1, bref, (int8_t)-16, (int8_t)15));
  }
  if (delta_f_pucch_f2_present) {
    HANDLE_CODE(unpack_integer(delta_f_pucch_f2, bref, (int8_t)-16, (int8_t)15));
  }
  if (delta_f_pucch_f3_present) {
    HANDLE_CODE(unpack_integer(delta_f_pucch_f3, bref, (int8_t)-16, (int8_t)15));
  }
  if (delta_f_pucch_f4_present) {
    HANDLE_CODE(unpack_integer(delta_f_pucch_f4, bref, (int8_t)-16, (int8_t)15));
  }
  if (p0_set_present) {
    HANDLE_CODE(unpack_dyn_seq_of(p0_set, bref, 1, 8));
  }
  if (pathloss_ref_rss_present) {
    HANDLE_CODE(unpack_dyn_seq_of(pathloss_ref_rss, bref, 1, 4));
  }

  if (ext) {
    ext_groups_unpacker_guard group_flags(1);
    group_flags.unpack(bref);

    if (group_flags[0]) {
      varlength_field_unpack_guard varlen_scope(bref, false);

      unpack_presence_flag(pathloss_ref_rss_v1610, bref);
      if (pathloss_ref_rss_v1610.is_present()) {
        HANDLE_CODE(pathloss_ref_rss_v1610->unpack(bref));
      }
    }
  }
  return SRSASN_SUCCESS;
}
void pucch_pwr_ctrl_s::to_json(json_writer& j) const
{
  j.start_obj();
  if (delta_f_pucch_f0_present) {
    j.write_int("deltaF-PUCCH-f0", delta_f_pucch_f0);
  }
  if (delta_f_pucch_f1_present) {
    j.write_int("deltaF-PUCCH-f1", delta_f_pucch_f1);
  }
  if (delta_f_pucch_f2_present) {
    j.write_int("deltaF-PUCCH-f2", delta_f_pucch_f2);
  }
  if (delta_f_pucch_f3_present) {
    j.write_int("deltaF-PUCCH-f3", delta_f_pucch_f3);
  }
  if (delta_f_pucch_f4_present) {
    j.write_int("deltaF-PUCCH-f4", delta_f_pucch_f4);
  }
  if (p0_set.size() > 0) {
    j.start_array("p0-Set");
    for (const auto& e1 : p0_set) {
      e1.to_json(j);
    }
    j.end_array();
  }
  if (pathloss_ref_rss.size() > 0) {
    j.start_array("pathlossReferenceRSs");
    for (const auto& e1 : pathloss_ref_rss) {
      e1.to_json(j);
    }
    j.end_array();
  }
  if (two_pucch_pc_adjustment_states_present) {
    j.write_str("twoPUCCH-PC-AdjustmentStates", "twoStates");
  }
  if (ext) {
    if (pathloss_ref_rss_v1610.is_present()) {
      j.write_fieldname("pathlossReferenceRSs-v1610");
      pathloss_ref_rss_v1610->to_json(j);
    }
  }
  j.end_obj();
}

// PUCCH-PowerControlSetInfo-r17 ::= SEQUENCE
SRSASN_CODE pucch_pwr_ctrl_set_info_r17_s::pack(bit_ref& bref) const
{
  HANDLE_CODE(pack_integer(bref, pucch_pwr_ctrl_set_info_id_r17, (uint8_t)1u, (uint8_t)8u));
  HANDLE_CODE(pack_integer(bref, p0_pucch_id_r17, (uint8_t)1u, (uint8_t)8u));
  HANDLE_CODE(pucch_closed_loop_idx_r17.pack(bref));
  HANDLE_CODE(pack_integer(bref, pucch_pathloss_ref_rs_id_r17, (uint8_t)0u, (uint8_t)7u));

  return SRSASN_SUCCESS;
}
SRSASN_CODE pucch_pwr_ctrl_set_info_r17_s::unpack(cbit_ref& bref)
{
  HANDLE_CODE(unpack_integer(pucch_pwr_ctrl_set_info_id_r17, bref, (uint8_t)1u, (uint8_t)8u));
  HANDLE_CODE(unpack_integer(p0_pucch_id_r17, bref, (uint8_t)1u, (uint8_t)8u));
  HANDLE_CODE(pucch_closed_loop_idx_r17.unpack(bref));
  HANDLE_CODE(unpack_integer(pucch_pathloss_ref_rs_id_r17, bref, (uint8_t)0u, (uint8_t)7u));

  return SRSASN_SUCCESS;
}
void pucch_pwr_ctrl_set_info_r17_s::to_json(json_writer& j) const
{
  j.start_obj();
  j.write_int("pucch-PowerControlSetInfoId-r17", pucch_pwr_ctrl_set_info_id_r17);
  j.write_int("p0-PUCCH-Id-r17", p0_pucch_id_r17);
  j.write_str("pucch-ClosedLoopIndex-r17", pucch_closed_loop_idx_r17.to_string());
  j.write_int("pucch-PathlossReferenceRS-Id-r17", pucch_pathloss_ref_rs_id_r17);
  j.end_obj();
}

const char* pucch_pwr_ctrl_set_info_r17_s::pucch_closed_loop_idx_r17_opts::to_string() const
{
  static const char* names[] = {"i0", "i1"};
  return convert_enum_idx(names, 2, value, "pucch_pwr_ctrl_set_info_r17_s::pucch_closed_loop_idx_r17_e_");
}
uint8_t pucch_pwr_ctrl_set_info_r17_s::pucch_closed_loop_idx_r17_opts::to_number() const
{
  static const uint8_t numbers[] = {0, 1};
  return map_enum_number(numbers, 2, value, "pucch_pwr_ctrl_set_info_r17_s::pucch_closed_loop_idx_r17_e_");
}

// PUCCH-Resource ::= SEQUENCE
SRSASN_CODE pucch_res_s::pack(bit_ref& bref) const
{
  HANDLE_CODE(bref.pack(intra_slot_freq_hop_present, 1));
  HANDLE_CODE(bref.pack(second_hop_prb_present, 1));

  HANDLE_CODE(pack_integer(bref, pucch_res_id, (uint8_t)0u, (uint8_t)127u));
  HANDLE_CODE(pack_integer(bref, start_prb, (uint16_t)0u, (uint16_t)274u));
  if (second_hop_prb_present) {
    HANDLE_CODE(pack_integer(bref, second_hop_prb, (uint16_t)0u, (uint16_t)274u));
  }
  HANDLE_CODE(format.pack(bref));

  return SRSASN_SUCCESS;
}
SRSASN_CODE pucch_res_s::unpack(cbit_ref& bref)
{
  HANDLE_CODE(bref.unpack(intra_slot_freq_hop_present, 1));
  HANDLE_CODE(bref.unpack(second_hop_prb_present, 1));

  HANDLE_CODE(unpack_integer(pucch_res_id, bref, (uint8_t)0u, (uint8_t)127u));
  HANDLE_CODE(unpack_integer(start_prb, bref, (uint16_t)0u, (uint16_t)274u));
  if (second_hop_prb_present) {
    HANDLE_CODE(unpack_integer(second_hop_prb, bref, (uint16_t)0u, (uint16_t)274u));
  }
  HANDLE_CODE(format.unpack(bref));

  return SRSASN_SUCCESS;
}
void pucch_res_s::to_json(json_writer& j) const
{
  j.start_obj();
  j.write_int("pucch-ResourceId", pucch_res_id);
  j.write_int("startingPRB", start_prb);
  if (intra_slot_freq_hop_present) {
    j.write_str("intraSlotFrequencyHopping", "enabled");
  }
  if (second_hop_prb_present) {
    j.write_int("secondHopPRB", second_hop_prb);
  }
  j.write_fieldname("format");
  format.to_json(j);
  j.end_obj();
}

void pucch_res_s::format_c_::destroy_()
{
  switch (type_) {
    case types::format0:
      c.destroy<pucch_format0_s>();
      break;
    case types::format1:
      c.destroy<pucch_format1_s>();
      break;
    case types::format2:
      c.destroy<pucch_format2_s>();
      break;
    case types::format3:
      c.destroy<pucch_format3_s>();
      break;
    case types::format4:
      c.destroy<pucch_format4_s>();
      break;
    default:
      break;
  }
}
void pucch_res_s::format_c_::set(types::options e)
{
  destroy_();
  type_ = e;
  switch (type_) {
    case types::format0:
      c.init<pucch_format0_s>();
      break;
    case types::format1:
      c.init<pucch_format1_s>();
      break;
    case types::format2:
      c.init<pucch_format2_s>();
      break;
    case types::format3:
      c.init<pucch_format3_s>();
      break;
    case types::format4:
      c.init<pucch_format4_s>();
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "pucch_res_s::format_c_");
  }
}
pucch_res_s::format_c_::format_c_(const pucch_res_s::format_c_& other)
{
  type_ = other.type();
  switch (type_) {
    case types::format0:
      c.init(other.c.get<pucch_format0_s>());
      break;
    case types::format1:
      c.init(other.c.get<pucch_format1_s>());
      break;
    case types::format2:
      c.init(other.c.get<pucch_format2_s>());
      break;
    case types::format3:
      c.init(other.c.get<pucch_format3_s>());
      break;
    case types::format4:
      c.init(other.c.get<pucch_format4_s>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "pucch_res_s::format_c_");
  }
}
pucch_res_s::format_c_& pucch_res_s::format_c_::operator=(const pucch_res_s::format_c_& other)
{
  if (this == &other) {
    return *this;
  }
  set(other.type());
  switch (type_) {
    case types::format0:
      c.set(other.c.get<pucch_format0_s>());
      break;
    case types::format1:
      c.set(other.c.get<pucch_format1_s>());
      break;
    case types::format2:
      c.set(other.c.get<pucch_format2_s>());
      break;
    case types::format3:
      c.set(other.c.get<pucch_format3_s>());
      break;
    case types::format4:
      c.set(other.c.get<pucch_format4_s>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "pucch_res_s::format_c_");
  }

  return *this;
}
pucch_format0_s& pucch_res_s::format_c_::set_format0()
{
  set(types::format0);
  return c.get<pucch_format0_s>();
}
pucch_format1_s& pucch_res_s::format_c_::set_format1()
{
  set(types::format1);
  return c.get<pucch_format1_s>();
}
pucch_format2_s& pucch_res_s::format_c_::set_format2()
{
  set(types::format2);
  return c.get<pucch_format2_s>();
}
pucch_format3_s& pucch_res_s::format_c_::set_format3()
{
  set(types::format3);
  return c.get<pucch_format3_s>();
}
pucch_format4_s& pucch_res_s::format_c_::set_format4()
{
  set(types::format4);
  return c.get<pucch_format4_s>();
}
void pucch_res_s::format_c_::to_json(json_writer& j) const
{
  j.start_obj();
  switch (type_) {
    case types::format0:
      j.write_fieldname("format0");
      c.get<pucch_format0_s>().to_json(j);
      break;
    case types::format1:
      j.write_fieldname("format1");
      c.get<pucch_format1_s>().to_json(j);
      break;
    case types::format2:
      j.write_fieldname("format2");
      c.get<pucch_format2_s>().to_json(j);
      break;
    case types::format3:
      j.write_fieldname("format3");
      c.get<pucch_format3_s>().to_json(j);
      break;
    case types::format4:
      j.write_fieldname("format4");
      c.get<pucch_format4_s>().to_json(j);
      break;
    default:
      log_invalid_choice_id(type_, "pucch_res_s::format_c_");
  }
  j.end_obj();
}
SRSASN_CODE pucch_res_s::format_c_::pack(bit_ref& bref) const
{
  type_.pack(bref);
  switch (type_) {
    case types::format0:
      HANDLE_CODE(c.get<pucch_format0_s>().pack(bref));
      break;
    case types::format1:
      HANDLE_CODE(c.get<pucch_format1_s>().pack(bref));
      break;
    case types::format2:
      HANDLE_CODE(c.get<pucch_format2_s>().pack(bref));
      break;
    case types::format3:
      HANDLE_CODE(c.get<pucch_format3_s>().pack(bref));
      break;
    case types::format4:
      HANDLE_CODE(c.get<pucch_format4_s>().pack(bref));
      break;
    default:
      log_invalid_choice_id(type_, "pucch_res_s::format_c_");
      return SRSASN_ERROR_ENCODE_FAIL;
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE pucch_res_s::format_c_::unpack(cbit_ref& bref)
{
  types e;
  e.unpack(bref);
  set(e);
  switch (type_) {
    case types::format0:
      HANDLE_CODE(c.get<pucch_format0_s>().unpack(bref));
      break;
    case types::format1:
      HANDLE_CODE(c.get<pucch_format1_s>().unpack(bref));
      break;
    case types::format2:
      HANDLE_CODE(c.get<pucch_format2_s>().unpack(bref));
      break;
    case types::format3:
      HANDLE_CODE(c.get<pucch_format3_s>().unpack(bref));
      break;
    case types::format4:
      HANDLE_CODE(c.get<pucch_format4_s>().unpack(bref));
      break;
    default:
      log_invalid_choice_id(type_, "pucch_res_s::format_c_");
      return SRSASN_ERROR_DECODE_FAIL;
  }
  return SRSASN_SUCCESS;
}

const char* pucch_res_s::format_c_::types_opts::to_string() const
{
  static const char* names[] = {"format0", "format1", "format2", "format3", "format4"};
  return convert_enum_idx(names, 5, value, "pucch_res_s::format_c_::types");
}
uint8_t pucch_res_s::format_c_::types_opts::to_number() const
{
  static const uint8_t numbers[] = {0, 1, 2, 3, 4};
  return map_enum_number(numbers, 5, value, "pucch_res_s::format_c_::types");
}

// PUCCH-ResourceExt-v1610 ::= SEQUENCE
SRSASN_CODE pucch_res_ext_v1610_s::pack(bit_ref& bref) const
{
  bref.pack(ext, 1);
  HANDLE_CODE(bref.pack(interlace_alloc_r16_present, 1));
  HANDLE_CODE(bref.pack(format_v1610_present, 1));

  if (interlace_alloc_r16_present) {
    HANDLE_CODE(pack_integer(bref, interlace_alloc_r16.rb_set_idx_r16, (uint8_t)0u, (uint8_t)4u));
    HANDLE_CODE(interlace_alloc_r16.interlace0_r16.pack(bref));
  }
  if (format_v1610_present) {
    HANDLE_CODE(format_v1610.pack(bref));
  }

  if (ext) {
    ext_groups_packer_guard group_flags;
    group_flags[0] |= format_v1700.is_present();
    group_flags[0] |= pucch_repeat_nrof_slots_r17_present;
    group_flags.pack(bref);

    if (group_flags[0]) {
      varlength_field_pack_guard varlen_scope(bref, false);

      HANDLE_CODE(bref.pack(format_v1700.is_present(), 1));
      HANDLE_CODE(bref.pack(pucch_repeat_nrof_slots_r17_present, 1));
      if (format_v1700.is_present()) {
        HANDLE_CODE(pack_integer(bref, format_v1700->nrof_prbs_r17, (uint8_t)1u, (uint8_t)16u));
      }
      if (pucch_repeat_nrof_slots_r17_present) {
        HANDLE_CODE(pucch_repeat_nrof_slots_r17.pack(bref));
      }
    }
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE pucch_res_ext_v1610_s::unpack(cbit_ref& bref)
{
  bref.unpack(ext, 1);
  HANDLE_CODE(bref.unpack(interlace_alloc_r16_present, 1));
  HANDLE_CODE(bref.unpack(format_v1610_present, 1));

  if (interlace_alloc_r16_present) {
    HANDLE_CODE(unpack_integer(interlace_alloc_r16.rb_set_idx_r16, bref, (uint8_t)0u, (uint8_t)4u));
    HANDLE_CODE(interlace_alloc_r16.interlace0_r16.unpack(bref));
  }
  if (format_v1610_present) {
    HANDLE_CODE(format_v1610.unpack(bref));
  }

  if (ext) {
    ext_groups_unpacker_guard group_flags(1);
    group_flags.unpack(bref);

    if (group_flags[0]) {
      varlength_field_unpack_guard varlen_scope(bref, false);

      unpack_presence_flag(format_v1700, bref);
      HANDLE_CODE(bref.unpack(pucch_repeat_nrof_slots_r17_present, 1));
      if (format_v1700.is_present()) {
        HANDLE_CODE(unpack_integer(format_v1700->nrof_prbs_r17, bref, (uint8_t)1u, (uint8_t)16u));
      }
      if (pucch_repeat_nrof_slots_r17_present) {
        HANDLE_CODE(pucch_repeat_nrof_slots_r17.unpack(bref));
      }
    }
  }
  return SRSASN_SUCCESS;
}
void pucch_res_ext_v1610_s::to_json(json_writer& j) const
{
  j.start_obj();
  if (interlace_alloc_r16_present) {
    j.write_fieldname("interlaceAllocation-r16");
    j.start_obj();
    j.write_int("rb-SetIndex-r16", interlace_alloc_r16.rb_set_idx_r16);
    j.write_fieldname("interlace0-r16");
    interlace_alloc_r16.interlace0_r16.to_json(j);
    j.end_obj();
  }
  if (format_v1610_present) {
    j.write_fieldname("format-v1610");
    format_v1610.to_json(j);
  }
  if (ext) {
    if (format_v1700.is_present()) {
      j.write_fieldname("format-v1700");
      j.start_obj();
      j.write_int("nrofPRBs-r17", format_v1700->nrof_prbs_r17);
      j.end_obj();
    }
    if (pucch_repeat_nrof_slots_r17_present) {
      j.write_str("pucch-RepetitionNrofSlots-r17", pucch_repeat_nrof_slots_r17.to_string());
    }
  }
  j.end_obj();
}

void pucch_res_ext_v1610_s::interlace_alloc_r16_s_::interlace0_r16_c_::destroy_() {}
void pucch_res_ext_v1610_s::interlace_alloc_r16_s_::interlace0_r16_c_::set(types::options e)
{
  destroy_();
  type_ = e;
}
pucch_res_ext_v1610_s::interlace_alloc_r16_s_::interlace0_r16_c_::interlace0_r16_c_(
    const pucch_res_ext_v1610_s::interlace_alloc_r16_s_::interlace0_r16_c_& other)
{
  type_ = other.type();
  switch (type_) {
    case types::scs15:
      c.init(other.c.get<uint8_t>());
      break;
    case types::scs30:
      c.init(other.c.get<uint8_t>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "pucch_res_ext_v1610_s::interlace_alloc_r16_s_::interlace0_r16_c_");
  }
}
pucch_res_ext_v1610_s::interlace_alloc_r16_s_::interlace0_r16_c_&
pucch_res_ext_v1610_s::interlace_alloc_r16_s_::interlace0_r16_c_::operator=(
    const pucch_res_ext_v1610_s::interlace_alloc_r16_s_::interlace0_r16_c_& other)
{
  if (this == &other) {
    return *this;
  }
  set(other.type());
  switch (type_) {
    case types::scs15:
      c.set(other.c.get<uint8_t>());
      break;
    case types::scs30:
      c.set(other.c.get<uint8_t>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "pucch_res_ext_v1610_s::interlace_alloc_r16_s_::interlace0_r16_c_");
  }

  return *this;
}
uint8_t& pucch_res_ext_v1610_s::interlace_alloc_r16_s_::interlace0_r16_c_::set_scs15()
{
  set(types::scs15);
  return c.get<uint8_t>();
}
uint8_t& pucch_res_ext_v1610_s::interlace_alloc_r16_s_::interlace0_r16_c_::set_scs30()
{
  set(types::scs30);
  return c.get<uint8_t>();
}
void pucch_res_ext_v1610_s::interlace_alloc_r16_s_::interlace0_r16_c_::to_json(json_writer& j) const
{
  j.start_obj();
  switch (type_) {
    case types::scs15:
      j.write_int("scs15", c.get<uint8_t>());
      break;
    case types::scs30:
      j.write_int("scs30", c.get<uint8_t>());
      break;
    default:
      log_invalid_choice_id(type_, "pucch_res_ext_v1610_s::interlace_alloc_r16_s_::interlace0_r16_c_");
  }
  j.end_obj();
}
SRSASN_CODE pucch_res_ext_v1610_s::interlace_alloc_r16_s_::interlace0_r16_c_::pack(bit_ref& bref) const
{
  type_.pack(bref);
  switch (type_) {
    case types::scs15:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)9u));
      break;
    case types::scs30:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)4u));
      break;
    default:
      log_invalid_choice_id(type_, "pucch_res_ext_v1610_s::interlace_alloc_r16_s_::interlace0_r16_c_");
      return SRSASN_ERROR_ENCODE_FAIL;
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE pucch_res_ext_v1610_s::interlace_alloc_r16_s_::interlace0_r16_c_::unpack(cbit_ref& bref)
{
  types e;
  e.unpack(bref);
  set(e);
  switch (type_) {
    case types::scs15:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)9u));
      break;
    case types::scs30:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)4u));
      break;
    default:
      log_invalid_choice_id(type_, "pucch_res_ext_v1610_s::interlace_alloc_r16_s_::interlace0_r16_c_");
      return SRSASN_ERROR_DECODE_FAIL;
  }
  return SRSASN_SUCCESS;
}

const char* pucch_res_ext_v1610_s::interlace_alloc_r16_s_::interlace0_r16_c_::types_opts::to_string() const
{
  static const char* names[] = {"scs15", "scs30"};
  return convert_enum_idx(names, 2, value, "pucch_res_ext_v1610_s::interlace_alloc_r16_s_::interlace0_r16_c_::types");
}
uint8_t pucch_res_ext_v1610_s::interlace_alloc_r16_s_::interlace0_r16_c_::types_opts::to_number() const
{
  static const uint8_t numbers[] = {15, 30};
  return map_enum_number(numbers, 2, value, "pucch_res_ext_v1610_s::interlace_alloc_r16_s_::interlace0_r16_c_::types");
}

void pucch_res_ext_v1610_s::format_v1610_c_::destroy_()
{
  switch (type_) {
    case types::occ_v1610:
      c.destroy<occ_v1610_s_>();
      break;
    default:
      break;
  }
}
void pucch_res_ext_v1610_s::format_v1610_c_::set(types::options e)
{
  destroy_();
  type_ = e;
  switch (type_) {
    case types::interlace1_v1610:
      break;
    case types::occ_v1610:
      c.init<occ_v1610_s_>();
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "pucch_res_ext_v1610_s::format_v1610_c_");
  }
}
pucch_res_ext_v1610_s::format_v1610_c_::format_v1610_c_(const pucch_res_ext_v1610_s::format_v1610_c_& other)
{
  type_ = other.type();
  switch (type_) {
    case types::interlace1_v1610:
      c.init(other.c.get<uint8_t>());
      break;
    case types::occ_v1610:
      c.init(other.c.get<occ_v1610_s_>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "pucch_res_ext_v1610_s::format_v1610_c_");
  }
}
pucch_res_ext_v1610_s::format_v1610_c_&
pucch_res_ext_v1610_s::format_v1610_c_::operator=(const pucch_res_ext_v1610_s::format_v1610_c_& other)
{
  if (this == &other) {
    return *this;
  }
  set(other.type());
  switch (type_) {
    case types::interlace1_v1610:
      c.set(other.c.get<uint8_t>());
      break;
    case types::occ_v1610:
      c.set(other.c.get<occ_v1610_s_>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "pucch_res_ext_v1610_s::format_v1610_c_");
  }

  return *this;
}
uint8_t& pucch_res_ext_v1610_s::format_v1610_c_::set_interlace1_v1610()
{
  set(types::interlace1_v1610);
  return c.get<uint8_t>();
}
pucch_res_ext_v1610_s::format_v1610_c_::occ_v1610_s_& pucch_res_ext_v1610_s::format_v1610_c_::set_occ_v1610()
{
  set(types::occ_v1610);
  return c.get<occ_v1610_s_>();
}
void pucch_res_ext_v1610_s::format_v1610_c_::to_json(json_writer& j) const
{
  j.start_obj();
  switch (type_) {
    case types::interlace1_v1610:
      j.write_int("interlace1-v1610", c.get<uint8_t>());
      break;
    case types::occ_v1610:
      j.write_fieldname("occ-v1610");
      j.start_obj();
      if (c.get<occ_v1610_s_>().occ_len_v1610_present) {
        j.write_str("occ-Length-v1610", c.get<occ_v1610_s_>().occ_len_v1610.to_string());
      }
      if (c.get<occ_v1610_s_>().occ_idx_v1610_present) {
        j.write_str("occ-Index-v1610", c.get<occ_v1610_s_>().occ_idx_v1610.to_string());
      }
      j.end_obj();
      break;
    default:
      log_invalid_choice_id(type_, "pucch_res_ext_v1610_s::format_v1610_c_");
  }
  j.end_obj();
}
SRSASN_CODE pucch_res_ext_v1610_s::format_v1610_c_::pack(bit_ref& bref) const
{
  type_.pack(bref);
  switch (type_) {
    case types::interlace1_v1610:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)9u));
      break;
    case types::occ_v1610:
      HANDLE_CODE(bref.pack(c.get<occ_v1610_s_>().occ_len_v1610_present, 1));
      HANDLE_CODE(bref.pack(c.get<occ_v1610_s_>().occ_idx_v1610_present, 1));
      if (c.get<occ_v1610_s_>().occ_len_v1610_present) {
        HANDLE_CODE(c.get<occ_v1610_s_>().occ_len_v1610.pack(bref));
      }
      if (c.get<occ_v1610_s_>().occ_idx_v1610_present) {
        HANDLE_CODE(c.get<occ_v1610_s_>().occ_idx_v1610.pack(bref));
      }
      break;
    default:
      log_invalid_choice_id(type_, "pucch_res_ext_v1610_s::format_v1610_c_");
      return SRSASN_ERROR_ENCODE_FAIL;
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE pucch_res_ext_v1610_s::format_v1610_c_::unpack(cbit_ref& bref)
{
  types e;
  e.unpack(bref);
  set(e);
  switch (type_) {
    case types::interlace1_v1610:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)9u));
      break;
    case types::occ_v1610:
      HANDLE_CODE(bref.unpack(c.get<occ_v1610_s_>().occ_len_v1610_present, 1));
      HANDLE_CODE(bref.unpack(c.get<occ_v1610_s_>().occ_idx_v1610_present, 1));
      if (c.get<occ_v1610_s_>().occ_len_v1610_present) {
        HANDLE_CODE(c.get<occ_v1610_s_>().occ_len_v1610.unpack(bref));
      }
      if (c.get<occ_v1610_s_>().occ_idx_v1610_present) {
        HANDLE_CODE(c.get<occ_v1610_s_>().occ_idx_v1610.unpack(bref));
      }
      break;
    default:
      log_invalid_choice_id(type_, "pucch_res_ext_v1610_s::format_v1610_c_");
      return SRSASN_ERROR_DECODE_FAIL;
  }
  return SRSASN_SUCCESS;
}

const char* pucch_res_ext_v1610_s::format_v1610_c_::occ_v1610_s_::occ_len_v1610_opts::to_string() const
{
  static const char* names[] = {"n2", "n4"};
  return convert_enum_idx(names, 2, value, "pucch_res_ext_v1610_s::format_v1610_c_::occ_v1610_s_::occ_len_v1610_e_");
}
uint8_t pucch_res_ext_v1610_s::format_v1610_c_::occ_v1610_s_::occ_len_v1610_opts::to_number() const
{
  static const uint8_t numbers[] = {2, 4};
  return map_enum_number(numbers, 2, value, "pucch_res_ext_v1610_s::format_v1610_c_::occ_v1610_s_::occ_len_v1610_e_");
}

const char* pucch_res_ext_v1610_s::format_v1610_c_::occ_v1610_s_::occ_idx_v1610_opts::to_string() const
{
  static const char* names[] = {"n0", "n1", "n2", "n3"};
  return convert_enum_idx(names, 4, value, "pucch_res_ext_v1610_s::format_v1610_c_::occ_v1610_s_::occ_idx_v1610_e_");
}
uint8_t pucch_res_ext_v1610_s::format_v1610_c_::occ_v1610_s_::occ_idx_v1610_opts::to_number() const
{
  static const uint8_t numbers[] = {0, 1, 2, 3};
  return map_enum_number(numbers, 4, value, "pucch_res_ext_v1610_s::format_v1610_c_::occ_v1610_s_::occ_idx_v1610_e_");
}

const char* pucch_res_ext_v1610_s::format_v1610_c_::types_opts::to_string() const
{
  static const char* names[] = {"interlace1-v1610", "occ-v1610"};
  return convert_enum_idx(names, 2, value, "pucch_res_ext_v1610_s::format_v1610_c_::types");
}
uint8_t pucch_res_ext_v1610_s::format_v1610_c_::types_opts::to_number() const
{
  static const uint8_t numbers[] = {1};
  return map_enum_number(numbers, 1, value, "pucch_res_ext_v1610_s::format_v1610_c_::types");
}

const char* pucch_res_ext_v1610_s::pucch_repeat_nrof_slots_r17_opts::to_string() const
{
  static const char* names[] = {"n1", "n2", "n4", "n8"};
  return convert_enum_idx(names, 4, value, "pucch_res_ext_v1610_s::pucch_repeat_nrof_slots_r17_e_");
}
uint8_t pucch_res_ext_v1610_s::pucch_repeat_nrof_slots_r17_opts::to_number() const
{
  static const uint8_t numbers[] = {1, 2, 4, 8};
  return map_enum_number(numbers, 4, value, "pucch_res_ext_v1610_s::pucch_repeat_nrof_slots_r17_e_");
}

// PUCCH-ResourceGroup-r16 ::= SEQUENCE
SRSASN_CODE pucch_res_group_r16_s::pack(bit_ref& bref) const
{
  HANDLE_CODE(pack_integer(bref, pucch_res_group_id_r16, (uint8_t)0u, (uint8_t)3u));
  HANDLE_CODE(pack_dyn_seq_of(bref, res_per_group_list_r16, 1, 128, integer_packer<uint8_t>(0, 127)));

  return SRSASN_SUCCESS;
}
SRSASN_CODE pucch_res_group_r16_s::unpack(cbit_ref& bref)
{
  HANDLE_CODE(unpack_integer(pucch_res_group_id_r16, bref, (uint8_t)0u, (uint8_t)3u));
  HANDLE_CODE(unpack_dyn_seq_of(res_per_group_list_r16, bref, 1, 128, integer_packer<uint8_t>(0, 127)));

  return SRSASN_SUCCESS;
}
void pucch_res_group_r16_s::to_json(json_writer& j) const
{
  j.start_obj();
  j.write_int("pucch-ResourceGroupId-r16", pucch_res_group_id_r16);
  j.start_array("resourcePerGroupList-r16");
  for (const auto& e1 : res_per_group_list_r16) {
    j.write_int(e1);
  }
  j.end_array();
  j.end_obj();
}

// PUCCH-ResourceSet ::= SEQUENCE
SRSASN_CODE pucch_res_set_s::pack(bit_ref& bref) const
{
  HANDLE_CODE(bref.pack(max_payload_size_present, 1));

  HANDLE_CODE(pack_integer(bref, pucch_res_set_id, (uint8_t)0u, (uint8_t)3u));
  HANDLE_CODE(pack_dyn_seq_of(bref, res_list, 1, 32, integer_packer<uint8_t>(0, 127)));
  if (max_payload_size_present) {
    HANDLE_CODE(pack_integer(bref, max_payload_size, (uint16_t)4u, (uint16_t)256u));
  }

  return SRSASN_SUCCESS;
}
SRSASN_CODE pucch_res_set_s::unpack(cbit_ref& bref)
{
  HANDLE_CODE(bref.unpack(max_payload_size_present, 1));

  HANDLE_CODE(unpack_integer(pucch_res_set_id, bref, (uint8_t)0u, (uint8_t)3u));
  HANDLE_CODE(unpack_dyn_seq_of(res_list, bref, 1, 32, integer_packer<uint8_t>(0, 127)));
  if (max_payload_size_present) {
    HANDLE_CODE(unpack_integer(max_payload_size, bref, (uint16_t)4u, (uint16_t)256u));
  }

  return SRSASN_SUCCESS;
}
void pucch_res_set_s::to_json(json_writer& j) const
{
  j.start_obj();
  j.write_int("pucch-ResourceSetId", pucch_res_set_id);
  j.start_array("resourceList");
  for (const auto& e1 : res_list) {
    j.write_int(e1);
  }
  j.end_array();
  if (max_payload_size_present) {
    j.write_int("maxPayloadSize", max_payload_size);
  }
  j.end_obj();
}

// PUCCH-SpatialRelationInfo ::= SEQUENCE
SRSASN_CODE pucch_spatial_relation_info_s::pack(bit_ref& bref) const
{
  HANDLE_CODE(bref.pack(serving_cell_id_present, 1));

  HANDLE_CODE(pack_integer(bref, pucch_spatial_relation_info_id, (uint8_t)1u, (uint8_t)8u));
  if (serving_cell_id_present) {
    HANDLE_CODE(pack_integer(bref, serving_cell_id, (uint8_t)0u, (uint8_t)31u));
  }
  HANDLE_CODE(ref_sig.pack(bref));
  HANDLE_CODE(pack_integer(bref, pucch_pathloss_ref_rs_id, (uint8_t)0u, (uint8_t)3u));
  HANDLE_CODE(pack_integer(bref, p0_pucch_id, (uint8_t)1u, (uint8_t)8u));
  HANDLE_CODE(closed_loop_idx.pack(bref));

  return SRSASN_SUCCESS;
}
SRSASN_CODE pucch_spatial_relation_info_s::unpack(cbit_ref& bref)
{
  HANDLE_CODE(bref.unpack(serving_cell_id_present, 1));

  HANDLE_CODE(unpack_integer(pucch_spatial_relation_info_id, bref, (uint8_t)1u, (uint8_t)8u));
  if (serving_cell_id_present) {
    HANDLE_CODE(unpack_integer(serving_cell_id, bref, (uint8_t)0u, (uint8_t)31u));
  }
  HANDLE_CODE(ref_sig.unpack(bref));
  HANDLE_CODE(unpack_integer(pucch_pathloss_ref_rs_id, bref, (uint8_t)0u, (uint8_t)3u));
  HANDLE_CODE(unpack_integer(p0_pucch_id, bref, (uint8_t)1u, (uint8_t)8u));
  HANDLE_CODE(closed_loop_idx.unpack(bref));

  return SRSASN_SUCCESS;
}
void pucch_spatial_relation_info_s::to_json(json_writer& j) const
{
  j.start_obj();
  j.write_int("pucch-SpatialRelationInfoId", pucch_spatial_relation_info_id);
  if (serving_cell_id_present) {
    j.write_int("servingCellId", serving_cell_id);
  }
  j.write_fieldname("referenceSignal");
  ref_sig.to_json(j);
  j.write_int("pucch-PathlossReferenceRS-Id", pucch_pathloss_ref_rs_id);
  j.write_int("p0-PUCCH-Id", p0_pucch_id);
  j.write_str("closedLoopIndex", closed_loop_idx.to_string());
  j.end_obj();
}

void pucch_spatial_relation_info_s::ref_sig_c_::destroy_()
{
  switch (type_) {
    case types::srs:
      c.destroy<pucch_srs_s>();
      break;
    default:
      break;
  }
}
void pucch_spatial_relation_info_s::ref_sig_c_::set(types::options e)
{
  destroy_();
  type_ = e;
  switch (type_) {
    case types::ssb_idx:
      break;
    case types::csi_rs_idx:
      break;
    case types::srs:
      c.init<pucch_srs_s>();
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "pucch_spatial_relation_info_s::ref_sig_c_");
  }
}
pucch_spatial_relation_info_s::ref_sig_c_::ref_sig_c_(const pucch_spatial_relation_info_s::ref_sig_c_& other)
{
  type_ = other.type();
  switch (type_) {
    case types::ssb_idx:
      c.init(other.c.get<uint8_t>());
      break;
    case types::csi_rs_idx:
      c.init(other.c.get<uint8_t>());
      break;
    case types::srs:
      c.init(other.c.get<pucch_srs_s>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "pucch_spatial_relation_info_s::ref_sig_c_");
  }
}
pucch_spatial_relation_info_s::ref_sig_c_&
pucch_spatial_relation_info_s::ref_sig_c_::operator=(const pucch_spatial_relation_info_s::ref_sig_c_& other)
{
  if (this == &other) {
    return *this;
  }
  set(other.type());
  switch (type_) {
    case types::ssb_idx:
      c.set(other.c.get<uint8_t>());
      break;
    case types::csi_rs_idx:
      c.set(other.c.get<uint8_t>());
      break;
    case types::srs:
      c.set(other.c.get<pucch_srs_s>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "pucch_spatial_relation_info_s::ref_sig_c_");
  }

  return *this;
}
uint8_t& pucch_spatial_relation_info_s::ref_sig_c_::set_ssb_idx()
{
  set(types::ssb_idx);
  return c.get<uint8_t>();
}
uint8_t& pucch_spatial_relation_info_s::ref_sig_c_::set_csi_rs_idx()
{
  set(types::csi_rs_idx);
  return c.get<uint8_t>();
}
pucch_srs_s& pucch_spatial_relation_info_s::ref_sig_c_::set_srs()
{
  set(types::srs);
  return c.get<pucch_srs_s>();
}
void pucch_spatial_relation_info_s::ref_sig_c_::to_json(json_writer& j) const
{
  j.start_obj();
  switch (type_) {
    case types::ssb_idx:
      j.write_int("ssb-Index", c.get<uint8_t>());
      break;
    case types::csi_rs_idx:
      j.write_int("csi-RS-Index", c.get<uint8_t>());
      break;
    case types::srs:
      j.write_fieldname("srs");
      c.get<pucch_srs_s>().to_json(j);
      break;
    default:
      log_invalid_choice_id(type_, "pucch_spatial_relation_info_s::ref_sig_c_");
  }
  j.end_obj();
}
SRSASN_CODE pucch_spatial_relation_info_s::ref_sig_c_::pack(bit_ref& bref) const
{
  type_.pack(bref);
  switch (type_) {
    case types::ssb_idx:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)63u));
      break;
    case types::csi_rs_idx:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)191u));
      break;
    case types::srs:
      HANDLE_CODE(c.get<pucch_srs_s>().pack(bref));
      break;
    default:
      log_invalid_choice_id(type_, "pucch_spatial_relation_info_s::ref_sig_c_");
      return SRSASN_ERROR_ENCODE_FAIL;
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE pucch_spatial_relation_info_s::ref_sig_c_::unpack(cbit_ref& bref)
{
  types e;
  e.unpack(bref);
  set(e);
  switch (type_) {
    case types::ssb_idx:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)63u));
      break;
    case types::csi_rs_idx:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)191u));
      break;
    case types::srs:
      HANDLE_CODE(c.get<pucch_srs_s>().unpack(bref));
      break;
    default:
      log_invalid_choice_id(type_, "pucch_spatial_relation_info_s::ref_sig_c_");
      return SRSASN_ERROR_DECODE_FAIL;
  }
  return SRSASN_SUCCESS;
}

const char* pucch_spatial_relation_info_s::ref_sig_c_::types_opts::to_string() const
{
  static const char* names[] = {"ssb-Index", "csi-RS-Index", "srs"};
  return convert_enum_idx(names, 3, value, "pucch_spatial_relation_info_s::ref_sig_c_::types");
}

const char* pucch_spatial_relation_info_s::closed_loop_idx_opts::to_string() const
{
  static const char* names[] = {"i0", "i1"};
  return convert_enum_idx(names, 2, value, "pucch_spatial_relation_info_s::closed_loop_idx_e_");
}
uint8_t pucch_spatial_relation_info_s::closed_loop_idx_opts::to_number() const
{
  static const uint8_t numbers[] = {0, 1};
  return map_enum_number(numbers, 2, value, "pucch_spatial_relation_info_s::closed_loop_idx_e_");
}

// PUCCH-SpatialRelationInfoExt-r16 ::= SEQUENCE
SRSASN_CODE pucch_spatial_relation_info_ext_r16_s::pack(bit_ref& bref) const
{
  bref.pack(ext, 1);
  HANDLE_CODE(bref.pack(pucch_spatial_relation_info_id_v1610_present, 1));
  HANDLE_CODE(bref.pack(pucch_pathloss_ref_rs_id_v1610_present, 1));

  if (pucch_spatial_relation_info_id_v1610_present) {
    HANDLE_CODE(pack_integer(bref, pucch_spatial_relation_info_id_v1610, (uint8_t)9u, (uint8_t)64u));
  }
  if (pucch_pathloss_ref_rs_id_v1610_present) {
    HANDLE_CODE(pack_integer(bref, pucch_pathloss_ref_rs_id_v1610, (uint8_t)4u, (uint8_t)63u));
  }

  return SRSASN_SUCCESS;
}
SRSASN_CODE pucch_spatial_relation_info_ext_r16_s::unpack(cbit_ref& bref)
{
  bref.unpack(ext, 1);
  HANDLE_CODE(bref.unpack(pucch_spatial_relation_info_id_v1610_present, 1));
  HANDLE_CODE(bref.unpack(pucch_pathloss_ref_rs_id_v1610_present, 1));

  if (pucch_spatial_relation_info_id_v1610_present) {
    HANDLE_CODE(unpack_integer(pucch_spatial_relation_info_id_v1610, bref, (uint8_t)9u, (uint8_t)64u));
  }
  if (pucch_pathloss_ref_rs_id_v1610_present) {
    HANDLE_CODE(unpack_integer(pucch_pathloss_ref_rs_id_v1610, bref, (uint8_t)4u, (uint8_t)63u));
  }

  return SRSASN_SUCCESS;
}
void pucch_spatial_relation_info_ext_r16_s::to_json(json_writer& j) const
{
  j.start_obj();
  if (pucch_spatial_relation_info_id_v1610_present) {
    j.write_int("pucch-SpatialRelationInfoId-v1610", pucch_spatial_relation_info_id_v1610);
  }
  if (pucch_pathloss_ref_rs_id_v1610_present) {
    j.write_int("pucch-PathlossReferenceRS-Id-v1610", pucch_pathloss_ref_rs_id_v1610);
  }
  j.end_obj();
}

// PUSCH-PathlossReferenceRS ::= SEQUENCE
SRSASN_CODE pusch_pathloss_ref_rs_s::pack(bit_ref& bref) const
{
  HANDLE_CODE(pack_integer(bref, pusch_pathloss_ref_rs_id, (uint8_t)0u, (uint8_t)3u));
  HANDLE_CODE(ref_sig.pack(bref));

  return SRSASN_SUCCESS;
}
SRSASN_CODE pusch_pathloss_ref_rs_s::unpack(cbit_ref& bref)
{
  HANDLE_CODE(unpack_integer(pusch_pathloss_ref_rs_id, bref, (uint8_t)0u, (uint8_t)3u));
  HANDLE_CODE(ref_sig.unpack(bref));

  return SRSASN_SUCCESS;
}
void pusch_pathloss_ref_rs_s::to_json(json_writer& j) const
{
  j.start_obj();
  j.write_int("pusch-PathlossReferenceRS-Id", pusch_pathloss_ref_rs_id);
  j.write_fieldname("referenceSignal");
  ref_sig.to_json(j);
  j.end_obj();
}

void pusch_pathloss_ref_rs_s::ref_sig_c_::destroy_() {}
void pusch_pathloss_ref_rs_s::ref_sig_c_::set(types::options e)
{
  destroy_();
  type_ = e;
}
pusch_pathloss_ref_rs_s::ref_sig_c_::ref_sig_c_(const pusch_pathloss_ref_rs_s::ref_sig_c_& other)
{
  type_ = other.type();
  switch (type_) {
    case types::ssb_idx:
      c.init(other.c.get<uint8_t>());
      break;
    case types::csi_rs_idx:
      c.init(other.c.get<uint8_t>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "pusch_pathloss_ref_rs_s::ref_sig_c_");
  }
}
pusch_pathloss_ref_rs_s::ref_sig_c_&
pusch_pathloss_ref_rs_s::ref_sig_c_::operator=(const pusch_pathloss_ref_rs_s::ref_sig_c_& other)
{
  if (this == &other) {
    return *this;
  }
  set(other.type());
  switch (type_) {
    case types::ssb_idx:
      c.set(other.c.get<uint8_t>());
      break;
    case types::csi_rs_idx:
      c.set(other.c.get<uint8_t>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "pusch_pathloss_ref_rs_s::ref_sig_c_");
  }

  return *this;
}
uint8_t& pusch_pathloss_ref_rs_s::ref_sig_c_::set_ssb_idx()
{
  set(types::ssb_idx);
  return c.get<uint8_t>();
}
uint8_t& pusch_pathloss_ref_rs_s::ref_sig_c_::set_csi_rs_idx()
{
  set(types::csi_rs_idx);
  return c.get<uint8_t>();
}
void pusch_pathloss_ref_rs_s::ref_sig_c_::to_json(json_writer& j) const
{
  j.start_obj();
  switch (type_) {
    case types::ssb_idx:
      j.write_int("ssb-Index", c.get<uint8_t>());
      break;
    case types::csi_rs_idx:
      j.write_int("csi-RS-Index", c.get<uint8_t>());
      break;
    default:
      log_invalid_choice_id(type_, "pusch_pathloss_ref_rs_s::ref_sig_c_");
  }
  j.end_obj();
}
SRSASN_CODE pusch_pathloss_ref_rs_s::ref_sig_c_::pack(bit_ref& bref) const
{
  type_.pack(bref);
  switch (type_) {
    case types::ssb_idx:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)63u));
      break;
    case types::csi_rs_idx:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)191u));
      break;
    default:
      log_invalid_choice_id(type_, "pusch_pathloss_ref_rs_s::ref_sig_c_");
      return SRSASN_ERROR_ENCODE_FAIL;
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE pusch_pathloss_ref_rs_s::ref_sig_c_::unpack(cbit_ref& bref)
{
  types e;
  e.unpack(bref);
  set(e);
  switch (type_) {
    case types::ssb_idx:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)63u));
      break;
    case types::csi_rs_idx:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)191u));
      break;
    default:
      log_invalid_choice_id(type_, "pusch_pathloss_ref_rs_s::ref_sig_c_");
      return SRSASN_ERROR_DECODE_FAIL;
  }
  return SRSASN_SUCCESS;
}

const char* pusch_pathloss_ref_rs_s::ref_sig_c_::types_opts::to_string() const
{
  static const char* names[] = {"ssb-Index", "csi-RS-Index"};
  return convert_enum_idx(names, 2, value, "pusch_pathloss_ref_rs_s::ref_sig_c_::types");
}

// PUSCH-PathlossReferenceRS-r16 ::= SEQUENCE
SRSASN_CODE pusch_pathloss_ref_rs_r16_s::pack(bit_ref& bref) const
{
  HANDLE_CODE(pack_integer(bref, pusch_pathloss_ref_rs_id_r16, (uint8_t)4u, (uint8_t)63u));
  HANDLE_CODE(ref_sig_r16.pack(bref));

  return SRSASN_SUCCESS;
}
SRSASN_CODE pusch_pathloss_ref_rs_r16_s::unpack(cbit_ref& bref)
{
  HANDLE_CODE(unpack_integer(pusch_pathloss_ref_rs_id_r16, bref, (uint8_t)4u, (uint8_t)63u));
  HANDLE_CODE(ref_sig_r16.unpack(bref));

  return SRSASN_SUCCESS;
}
void pusch_pathloss_ref_rs_r16_s::to_json(json_writer& j) const
{
  j.start_obj();
  j.write_int("pusch-PathlossReferenceRS-Id-r16", pusch_pathloss_ref_rs_id_r16);
  j.write_fieldname("referenceSignal-r16");
  ref_sig_r16.to_json(j);
  j.end_obj();
}

void pusch_pathloss_ref_rs_r16_s::ref_sig_r16_c_::destroy_() {}
void pusch_pathloss_ref_rs_r16_s::ref_sig_r16_c_::set(types::options e)
{
  destroy_();
  type_ = e;
}
pusch_pathloss_ref_rs_r16_s::ref_sig_r16_c_::ref_sig_r16_c_(const pusch_pathloss_ref_rs_r16_s::ref_sig_r16_c_& other)
{
  type_ = other.type();
  switch (type_) {
    case types::ssb_idx_r16:
      c.init(other.c.get<uint8_t>());
      break;
    case types::csi_rs_idx_r16:
      c.init(other.c.get<uint8_t>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "pusch_pathloss_ref_rs_r16_s::ref_sig_r16_c_");
  }
}
pusch_pathloss_ref_rs_r16_s::ref_sig_r16_c_&
pusch_pathloss_ref_rs_r16_s::ref_sig_r16_c_::operator=(const pusch_pathloss_ref_rs_r16_s::ref_sig_r16_c_& other)
{
  if (this == &other) {
    return *this;
  }
  set(other.type());
  switch (type_) {
    case types::ssb_idx_r16:
      c.set(other.c.get<uint8_t>());
      break;
    case types::csi_rs_idx_r16:
      c.set(other.c.get<uint8_t>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "pusch_pathloss_ref_rs_r16_s::ref_sig_r16_c_");
  }

  return *this;
}
uint8_t& pusch_pathloss_ref_rs_r16_s::ref_sig_r16_c_::set_ssb_idx_r16()
{
  set(types::ssb_idx_r16);
  return c.get<uint8_t>();
}
uint8_t& pusch_pathloss_ref_rs_r16_s::ref_sig_r16_c_::set_csi_rs_idx_r16()
{
  set(types::csi_rs_idx_r16);
  return c.get<uint8_t>();
}
void pusch_pathloss_ref_rs_r16_s::ref_sig_r16_c_::to_json(json_writer& j) const
{
  j.start_obj();
  switch (type_) {
    case types::ssb_idx_r16:
      j.write_int("ssb-Index-r16", c.get<uint8_t>());
      break;
    case types::csi_rs_idx_r16:
      j.write_int("csi-RS-Index-r16", c.get<uint8_t>());
      break;
    default:
      log_invalid_choice_id(type_, "pusch_pathloss_ref_rs_r16_s::ref_sig_r16_c_");
  }
  j.end_obj();
}
SRSASN_CODE pusch_pathloss_ref_rs_r16_s::ref_sig_r16_c_::pack(bit_ref& bref) const
{
  type_.pack(bref);
  switch (type_) {
    case types::ssb_idx_r16:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)63u));
      break;
    case types::csi_rs_idx_r16:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)191u));
      break;
    default:
      log_invalid_choice_id(type_, "pusch_pathloss_ref_rs_r16_s::ref_sig_r16_c_");
      return SRSASN_ERROR_ENCODE_FAIL;
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE pusch_pathloss_ref_rs_r16_s::ref_sig_r16_c_::unpack(cbit_ref& bref)
{
  types e;
  e.unpack(bref);
  set(e);
  switch (type_) {
    case types::ssb_idx_r16:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)63u));
      break;
    case types::csi_rs_idx_r16:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)191u));
      break;
    default:
      log_invalid_choice_id(type_, "pusch_pathloss_ref_rs_r16_s::ref_sig_r16_c_");
      return SRSASN_ERROR_DECODE_FAIL;
  }
  return SRSASN_SUCCESS;
}

const char* pusch_pathloss_ref_rs_r16_s::ref_sig_r16_c_::types_opts::to_string() const
{
  static const char* names[] = {"ssb-Index-r16", "csi-RS-Index-r16"};
  return convert_enum_idx(names, 2, value, "pusch_pathloss_ref_rs_r16_s::ref_sig_r16_c_::types");
}

// PUSCH-TimeDomainResourceAllocation-r16 ::= SEQUENCE
SRSASN_CODE pusch_time_domain_res_alloc_r16_s::pack(bit_ref& bref) const
{
  bref.pack(ext, 1);
  HANDLE_CODE(bref.pack(k2_r16_present, 1));

  if (k2_r16_present) {
    HANDLE_CODE(pack_integer(bref, k2_r16, (uint8_t)0u, (uint8_t)32u));
  }
  HANDLE_CODE(pack_dyn_seq_of(bref, pusch_alloc_list_r16, 1, 8));

  return SRSASN_SUCCESS;
}
SRSASN_CODE pusch_time_domain_res_alloc_r16_s::unpack(cbit_ref& bref)
{
  bref.unpack(ext, 1);
  HANDLE_CODE(bref.unpack(k2_r16_present, 1));

  if (k2_r16_present) {
    HANDLE_CODE(unpack_integer(k2_r16, bref, (uint8_t)0u, (uint8_t)32u));
  }
  HANDLE_CODE(unpack_dyn_seq_of(pusch_alloc_list_r16, bref, 1, 8));

  return SRSASN_SUCCESS;
}
void pusch_time_domain_res_alloc_r16_s::to_json(json_writer& j) const
{
  j.start_obj();
  if (k2_r16_present) {
    j.write_int("k2-r16", k2_r16);
  }
  j.start_array("puschAllocationList-r16");
  for (const auto& e1 : pusch_alloc_list_r16) {
    e1.to_json(j);
  }
  j.end_array();
  j.end_obj();
}

// SRI-PUSCH-PowerControl ::= SEQUENCE
SRSASN_CODE sri_pusch_pwr_ctrl_s::pack(bit_ref& bref) const
{
  HANDLE_CODE(pack_integer(bref, sri_pusch_pwr_ctrl_id, (uint8_t)0u, (uint8_t)15u));
  HANDLE_CODE(pack_integer(bref, sri_pusch_pathloss_ref_rs_id, (uint8_t)0u, (uint8_t)3u));
  HANDLE_CODE(pack_integer(bref, sri_p0_pusch_alpha_set_id, (uint8_t)0u, (uint8_t)29u));
  HANDLE_CODE(sri_pusch_closed_loop_idx.pack(bref));

  return SRSASN_SUCCESS;
}
SRSASN_CODE sri_pusch_pwr_ctrl_s::unpack(cbit_ref& bref)
{
  HANDLE_CODE(unpack_integer(sri_pusch_pwr_ctrl_id, bref, (uint8_t)0u, (uint8_t)15u));
  HANDLE_CODE(unpack_integer(sri_pusch_pathloss_ref_rs_id, bref, (uint8_t)0u, (uint8_t)3u));
  HANDLE_CODE(unpack_integer(sri_p0_pusch_alpha_set_id, bref, (uint8_t)0u, (uint8_t)29u));
  HANDLE_CODE(sri_pusch_closed_loop_idx.unpack(bref));

  return SRSASN_SUCCESS;
}
void sri_pusch_pwr_ctrl_s::to_json(json_writer& j) const
{
  j.start_obj();
  j.write_int("sri-PUSCH-PowerControlId", sri_pusch_pwr_ctrl_id);
  j.write_int("sri-PUSCH-PathlossReferenceRS-Id", sri_pusch_pathloss_ref_rs_id);
  j.write_int("sri-P0-PUSCH-AlphaSetId", sri_p0_pusch_alpha_set_id);
  j.write_str("sri-PUSCH-ClosedLoopIndex", sri_pusch_closed_loop_idx.to_string());
  j.end_obj();
}

const char* sri_pusch_pwr_ctrl_s::sri_pusch_closed_loop_idx_opts::to_string() const
{
  static const char* names[] = {"i0", "i1"};
  return convert_enum_idx(names, 2, value, "sri_pusch_pwr_ctrl_s::sri_pusch_closed_loop_idx_e_");
}
uint8_t sri_pusch_pwr_ctrl_s::sri_pusch_closed_loop_idx_opts::to_number() const
{
  static const uint8_t numbers[] = {0, 1};
  return map_enum_number(numbers, 2, value, "sri_pusch_pwr_ctrl_s::sri_pusch_closed_loop_idx_e_");
}

// SchedulingRequestResourceConfig ::= SEQUENCE
SRSASN_CODE sched_request_res_cfg_s::pack(bit_ref& bref) const
{
  HANDLE_CODE(bref.pack(periodicity_and_offset_present, 1));
  HANDLE_CODE(bref.pack(res_present, 1));

  HANDLE_CODE(pack_integer(bref, sched_request_res_id, (uint8_t)1u, (uint8_t)8u));
  HANDLE_CODE(pack_integer(bref, sched_request_id, (uint8_t)0u, (uint8_t)7u));
  if (periodicity_and_offset_present) {
    HANDLE_CODE(periodicity_and_offset.pack(bref));
  }
  if (res_present) {
    HANDLE_CODE(pack_integer(bref, res, (uint8_t)0u, (uint8_t)127u));
  }

  return SRSASN_SUCCESS;
}
SRSASN_CODE sched_request_res_cfg_s::unpack(cbit_ref& bref)
{
  HANDLE_CODE(bref.unpack(periodicity_and_offset_present, 1));
  HANDLE_CODE(bref.unpack(res_present, 1));

  HANDLE_CODE(unpack_integer(sched_request_res_id, bref, (uint8_t)1u, (uint8_t)8u));
  HANDLE_CODE(unpack_integer(sched_request_id, bref, (uint8_t)0u, (uint8_t)7u));
  if (periodicity_and_offset_present) {
    HANDLE_CODE(periodicity_and_offset.unpack(bref));
  }
  if (res_present) {
    HANDLE_CODE(unpack_integer(res, bref, (uint8_t)0u, (uint8_t)127u));
  }

  return SRSASN_SUCCESS;
}
void sched_request_res_cfg_s::to_json(json_writer& j) const
{
  j.start_obj();
  j.write_int("schedulingRequestResourceId", sched_request_res_id);
  j.write_int("schedulingRequestID", sched_request_id);
  if (periodicity_and_offset_present) {
    j.write_fieldname("periodicityAndOffset");
    periodicity_and_offset.to_json(j);
  }
  if (res_present) {
    j.write_int("resource", res);
  }
  j.end_obj();
}

void sched_request_res_cfg_s::periodicity_and_offset_c_::destroy_() {}
void sched_request_res_cfg_s::periodicity_and_offset_c_::set(types::options e)
{
  destroy_();
  type_ = e;
}
sched_request_res_cfg_s::periodicity_and_offset_c_::periodicity_and_offset_c_(
    const sched_request_res_cfg_s::periodicity_and_offset_c_& other)
{
  type_ = other.type();
  switch (type_) {
    case types::sym2:
      break;
    case types::sym6or7:
      break;
    case types::sl1:
      break;
    case types::sl2:
      c.init(other.c.get<uint8_t>());
      break;
    case types::sl4:
      c.init(other.c.get<uint8_t>());
      break;
    case types::sl5:
      c.init(other.c.get<uint8_t>());
      break;
    case types::sl8:
      c.init(other.c.get<uint8_t>());
      break;
    case types::sl10:
      c.init(other.c.get<uint8_t>());
      break;
    case types::sl16:
      c.init(other.c.get<uint8_t>());
      break;
    case types::sl20:
      c.init(other.c.get<uint8_t>());
      break;
    case types::sl40:
      c.init(other.c.get<uint8_t>());
      break;
    case types::sl80:
      c.init(other.c.get<uint8_t>());
      break;
    case types::sl160:
      c.init(other.c.get<uint8_t>());
      break;
    case types::sl320:
      c.init(other.c.get<uint16_t>());
      break;
    case types::sl640:
      c.init(other.c.get<uint16_t>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "sched_request_res_cfg_s::periodicity_and_offset_c_");
  }
}
sched_request_res_cfg_s::periodicity_and_offset_c_& sched_request_res_cfg_s::periodicity_and_offset_c_::operator=(
    const sched_request_res_cfg_s::periodicity_and_offset_c_& other)
{
  if (this == &other) {
    return *this;
  }
  set(other.type());
  switch (type_) {
    case types::sym2:
      break;
    case types::sym6or7:
      break;
    case types::sl1:
      break;
    case types::sl2:
      c.set(other.c.get<uint8_t>());
      break;
    case types::sl4:
      c.set(other.c.get<uint8_t>());
      break;
    case types::sl5:
      c.set(other.c.get<uint8_t>());
      break;
    case types::sl8:
      c.set(other.c.get<uint8_t>());
      break;
    case types::sl10:
      c.set(other.c.get<uint8_t>());
      break;
    case types::sl16:
      c.set(other.c.get<uint8_t>());
      break;
    case types::sl20:
      c.set(other.c.get<uint8_t>());
      break;
    case types::sl40:
      c.set(other.c.get<uint8_t>());
      break;
    case types::sl80:
      c.set(other.c.get<uint8_t>());
      break;
    case types::sl160:
      c.set(other.c.get<uint8_t>());
      break;
    case types::sl320:
      c.set(other.c.get<uint16_t>());
      break;
    case types::sl640:
      c.set(other.c.get<uint16_t>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "sched_request_res_cfg_s::periodicity_and_offset_c_");
  }

  return *this;
}
void sched_request_res_cfg_s::periodicity_and_offset_c_::set_sym2()
{
  set(types::sym2);
}
void sched_request_res_cfg_s::periodicity_and_offset_c_::set_sym6or7()
{
  set(types::sym6or7);
}
void sched_request_res_cfg_s::periodicity_and_offset_c_::set_sl1()
{
  set(types::sl1);
}
uint8_t& sched_request_res_cfg_s::periodicity_and_offset_c_::set_sl2()
{
  set(types::sl2);
  return c.get<uint8_t>();
}
uint8_t& sched_request_res_cfg_s::periodicity_and_offset_c_::set_sl4()
{
  set(types::sl4);
  return c.get<uint8_t>();
}
uint8_t& sched_request_res_cfg_s::periodicity_and_offset_c_::set_sl5()
{
  set(types::sl5);
  return c.get<uint8_t>();
}
uint8_t& sched_request_res_cfg_s::periodicity_and_offset_c_::set_sl8()
{
  set(types::sl8);
  return c.get<uint8_t>();
}
uint8_t& sched_request_res_cfg_s::periodicity_and_offset_c_::set_sl10()
{
  set(types::sl10);
  return c.get<uint8_t>();
}
uint8_t& sched_request_res_cfg_s::periodicity_and_offset_c_::set_sl16()
{
  set(types::sl16);
  return c.get<uint8_t>();
}
uint8_t& sched_request_res_cfg_s::periodicity_and_offset_c_::set_sl20()
{
  set(types::sl20);
  return c.get<uint8_t>();
}
uint8_t& sched_request_res_cfg_s::periodicity_and_offset_c_::set_sl40()
{
  set(types::sl40);
  return c.get<uint8_t>();
}
uint8_t& sched_request_res_cfg_s::periodicity_and_offset_c_::set_sl80()
{
  set(types::sl80);
  return c.get<uint8_t>();
}
uint8_t& sched_request_res_cfg_s::periodicity_and_offset_c_::set_sl160()
{
  set(types::sl160);
  return c.get<uint8_t>();
}
uint16_t& sched_request_res_cfg_s::periodicity_and_offset_c_::set_sl320()
{
  set(types::sl320);
  return c.get<uint16_t>();
}
uint16_t& sched_request_res_cfg_s::periodicity_and_offset_c_::set_sl640()
{
  set(types::sl640);
  return c.get<uint16_t>();
}
void sched_request_res_cfg_s::periodicity_and_offset_c_::to_json(json_writer& j) const
{
  j.start_obj();
  switch (type_) {
    case types::sym2:
      break;
    case types::sym6or7:
      break;
    case types::sl1:
      break;
    case types::sl2:
      j.write_int("sl2", c.get<uint8_t>());
      break;
    case types::sl4:
      j.write_int("sl4", c.get<uint8_t>());
      break;
    case types::sl5:
      j.write_int("sl5", c.get<uint8_t>());
      break;
    case types::sl8:
      j.write_int("sl8", c.get<uint8_t>());
      break;
    case types::sl10:
      j.write_int("sl10", c.get<uint8_t>());
      break;
    case types::sl16:
      j.write_int("sl16", c.get<uint8_t>());
      break;
    case types::sl20:
      j.write_int("sl20", c.get<uint8_t>());
      break;
    case types::sl40:
      j.write_int("sl40", c.get<uint8_t>());
      break;
    case types::sl80:
      j.write_int("sl80", c.get<uint8_t>());
      break;
    case types::sl160:
      j.write_int("sl160", c.get<uint8_t>());
      break;
    case types::sl320:
      j.write_int("sl320", c.get<uint16_t>());
      break;
    case types::sl640:
      j.write_int("sl640", c.get<uint16_t>());
      break;
    default:
      log_invalid_choice_id(type_, "sched_request_res_cfg_s::periodicity_and_offset_c_");
  }
  j.end_obj();
}
SRSASN_CODE sched_request_res_cfg_s::periodicity_and_offset_c_::pack(bit_ref& bref) const
{
  type_.pack(bref);
  switch (type_) {
    case types::sym2:
      break;
    case types::sym6or7:
      break;
    case types::sl1:
      break;
    case types::sl2:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)1u));
      break;
    case types::sl4:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)3u));
      break;
    case types::sl5:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)4u));
      break;
    case types::sl8:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)7u));
      break;
    case types::sl10:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)9u));
      break;
    case types::sl16:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)15u));
      break;
    case types::sl20:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)19u));
      break;
    case types::sl40:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)39u));
      break;
    case types::sl80:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)79u));
      break;
    case types::sl160:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)159u));
      break;
    case types::sl320:
      HANDLE_CODE(pack_integer(bref, c.get<uint16_t>(), (uint16_t)0u, (uint16_t)319u));
      break;
    case types::sl640:
      HANDLE_CODE(pack_integer(bref, c.get<uint16_t>(), (uint16_t)0u, (uint16_t)639u));
      break;
    default:
      log_invalid_choice_id(type_, "sched_request_res_cfg_s::periodicity_and_offset_c_");
      return SRSASN_ERROR_ENCODE_FAIL;
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE sched_request_res_cfg_s::periodicity_and_offset_c_::unpack(cbit_ref& bref)
{
  types e;
  e.unpack(bref);
  set(e);
  switch (type_) {
    case types::sym2:
      break;
    case types::sym6or7:
      break;
    case types::sl1:
      break;
    case types::sl2:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)1u));
      break;
    case types::sl4:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)3u));
      break;
    case types::sl5:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)4u));
      break;
    case types::sl8:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)7u));
      break;
    case types::sl10:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)9u));
      break;
    case types::sl16:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)15u));
      break;
    case types::sl20:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)19u));
      break;
    case types::sl40:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)39u));
      break;
    case types::sl80:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)79u));
      break;
    case types::sl160:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)159u));
      break;
    case types::sl320:
      HANDLE_CODE(unpack_integer(c.get<uint16_t>(), bref, (uint16_t)0u, (uint16_t)319u));
      break;
    case types::sl640:
      HANDLE_CODE(unpack_integer(c.get<uint16_t>(), bref, (uint16_t)0u, (uint16_t)639u));
      break;
    default:
      log_invalid_choice_id(type_, "sched_request_res_cfg_s::periodicity_and_offset_c_");
      return SRSASN_ERROR_DECODE_FAIL;
  }
  return SRSASN_SUCCESS;
}

const char* sched_request_res_cfg_s::periodicity_and_offset_c_::types_opts::to_string() const
{
  static const char* names[] = {"sym2",
                                "sym6or7",
                                "sl1",
                                "sl2",
                                "sl4",
                                "sl5",
                                "sl8",
                                "sl10",
                                "sl16",
                                "sl20",
                                "sl40",
                                "sl80",
                                "sl160",
                                "sl320",
                                "sl640"};
  return convert_enum_idx(names, 15, value, "sched_request_res_cfg_s::periodicity_and_offset_c_::types");
}

// SchedulingRequestResourceConfigExt-v1610 ::= SEQUENCE
SRSASN_CODE sched_request_res_cfg_ext_v1610_s::pack(bit_ref& bref) const
{
  bref.pack(ext, 1);
  HANDLE_CODE(bref.pack(phy_prio_idx_r16_present, 1));

  if (phy_prio_idx_r16_present) {
    HANDLE_CODE(phy_prio_idx_r16.pack(bref));
  }

  return SRSASN_SUCCESS;
}
SRSASN_CODE sched_request_res_cfg_ext_v1610_s::unpack(cbit_ref& bref)
{
  bref.unpack(ext, 1);
  HANDLE_CODE(bref.unpack(phy_prio_idx_r16_present, 1));

  if (phy_prio_idx_r16_present) {
    HANDLE_CODE(phy_prio_idx_r16.unpack(bref));
  }

  return SRSASN_SUCCESS;
}
void sched_request_res_cfg_ext_v1610_s::to_json(json_writer& j) const
{
  j.start_obj();
  if (phy_prio_idx_r16_present) {
    j.write_str("phy-PriorityIndex-r16", phy_prio_idx_r16.to_string());
  }
  j.end_obj();
}

const char* sched_request_res_cfg_ext_v1610_s::phy_prio_idx_r16_opts::to_string() const
{
  static const char* names[] = {"p0", "p1"};
  return convert_enum_idx(names, 2, value, "sched_request_res_cfg_ext_v1610_s::phy_prio_idx_r16_e_");
}
uint8_t sched_request_res_cfg_ext_v1610_s::phy_prio_idx_r16_opts::to_number() const
{
  static const uint8_t numbers[] = {0, 1};
  return map_enum_number(numbers, 2, value, "sched_request_res_cfg_ext_v1610_s::phy_prio_idx_r16_e_");
}

// SchedulingRequestResourceConfigExt-v1700 ::= SEQUENCE
SRSASN_CODE sched_request_res_cfg_ext_v1700_s::pack(bit_ref& bref) const
{
  HANDLE_CODE(bref.pack(periodicity_and_offset_r17_present, 1));

  if (periodicity_and_offset_r17_present) {
    HANDLE_CODE(periodicity_and_offset_r17.pack(bref));
  }

  return SRSASN_SUCCESS;
}
SRSASN_CODE sched_request_res_cfg_ext_v1700_s::unpack(cbit_ref& bref)
{
  HANDLE_CODE(bref.unpack(periodicity_and_offset_r17_present, 1));

  if (periodicity_and_offset_r17_present) {
    HANDLE_CODE(periodicity_and_offset_r17.unpack(bref));
  }

  return SRSASN_SUCCESS;
}
void sched_request_res_cfg_ext_v1700_s::to_json(json_writer& j) const
{
  j.start_obj();
  if (periodicity_and_offset_r17_present) {
    j.write_fieldname("periodicityAndOffset-r17");
    periodicity_and_offset_r17.to_json(j);
  }
  j.end_obj();
}

void sched_request_res_cfg_ext_v1700_s::periodicity_and_offset_r17_c_::destroy_() {}
void sched_request_res_cfg_ext_v1700_s::periodicity_and_offset_r17_c_::set(types::options e)
{
  destroy_();
  type_ = e;
}
sched_request_res_cfg_ext_v1700_s::periodicity_and_offset_r17_c_::periodicity_and_offset_r17_c_(
    const sched_request_res_cfg_ext_v1700_s::periodicity_and_offset_r17_c_& other)
{
  type_ = other.type();
  switch (type_) {
    case types::sl1280:
      c.init(other.c.get<uint16_t>());
      break;
    case types::sl2560:
      c.init(other.c.get<uint16_t>());
      break;
    case types::sl5120:
      c.init(other.c.get<uint16_t>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "sched_request_res_cfg_ext_v1700_s::periodicity_and_offset_r17_c_");
  }
}
sched_request_res_cfg_ext_v1700_s::periodicity_and_offset_r17_c_&
sched_request_res_cfg_ext_v1700_s::periodicity_and_offset_r17_c_::operator=(
    const sched_request_res_cfg_ext_v1700_s::periodicity_and_offset_r17_c_& other)
{
  if (this == &other) {
    return *this;
  }
  set(other.type());
  switch (type_) {
    case types::sl1280:
      c.set(other.c.get<uint16_t>());
      break;
    case types::sl2560:
      c.set(other.c.get<uint16_t>());
      break;
    case types::sl5120:
      c.set(other.c.get<uint16_t>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "sched_request_res_cfg_ext_v1700_s::periodicity_and_offset_r17_c_");
  }

  return *this;
}
uint16_t& sched_request_res_cfg_ext_v1700_s::periodicity_and_offset_r17_c_::set_sl1280()
{
  set(types::sl1280);
  return c.get<uint16_t>();
}
uint16_t& sched_request_res_cfg_ext_v1700_s::periodicity_and_offset_r17_c_::set_sl2560()
{
  set(types::sl2560);
  return c.get<uint16_t>();
}
uint16_t& sched_request_res_cfg_ext_v1700_s::periodicity_and_offset_r17_c_::set_sl5120()
{
  set(types::sl5120);
  return c.get<uint16_t>();
}
void sched_request_res_cfg_ext_v1700_s::periodicity_and_offset_r17_c_::to_json(json_writer& j) const
{
  j.start_obj();
  switch (type_) {
    case types::sl1280:
      j.write_int("sl1280", c.get<uint16_t>());
      break;
    case types::sl2560:
      j.write_int("sl2560", c.get<uint16_t>());
      break;
    case types::sl5120:
      j.write_int("sl5120", c.get<uint16_t>());
      break;
    default:
      log_invalid_choice_id(type_, "sched_request_res_cfg_ext_v1700_s::periodicity_and_offset_r17_c_");
  }
  j.end_obj();
}
SRSASN_CODE sched_request_res_cfg_ext_v1700_s::periodicity_and_offset_r17_c_::pack(bit_ref& bref) const
{
  type_.pack(bref);
  switch (type_) {
    case types::sl1280:
      HANDLE_CODE(pack_integer(bref, c.get<uint16_t>(), (uint16_t)0u, (uint16_t)1279u));
      break;
    case types::sl2560:
      HANDLE_CODE(pack_integer(bref, c.get<uint16_t>(), (uint16_t)0u, (uint16_t)2559u));
      break;
    case types::sl5120:
      HANDLE_CODE(pack_integer(bref, c.get<uint16_t>(), (uint16_t)0u, (uint16_t)5119u));
      break;
    default:
      log_invalid_choice_id(type_, "sched_request_res_cfg_ext_v1700_s::periodicity_and_offset_r17_c_");
      return SRSASN_ERROR_ENCODE_FAIL;
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE sched_request_res_cfg_ext_v1700_s::periodicity_and_offset_r17_c_::unpack(cbit_ref& bref)
{
  types e;
  e.unpack(bref);
  set(e);
  switch (type_) {
    case types::sl1280:
      HANDLE_CODE(unpack_integer(c.get<uint16_t>(), bref, (uint16_t)0u, (uint16_t)1279u));
      break;
    case types::sl2560:
      HANDLE_CODE(unpack_integer(c.get<uint16_t>(), bref, (uint16_t)0u, (uint16_t)2559u));
      break;
    case types::sl5120:
      HANDLE_CODE(unpack_integer(c.get<uint16_t>(), bref, (uint16_t)0u, (uint16_t)5119u));
      break;
    default:
      log_invalid_choice_id(type_, "sched_request_res_cfg_ext_v1700_s::periodicity_and_offset_r17_c_");
      return SRSASN_ERROR_DECODE_FAIL;
  }
  return SRSASN_SUCCESS;
}

const char* sched_request_res_cfg_ext_v1700_s::periodicity_and_offset_r17_c_::types_opts::to_string() const
{
  static const char* names[] = {"sl1280", "sl2560", "sl5120"};
  return convert_enum_idx(names, 3, value, "sched_request_res_cfg_ext_v1700_s::periodicity_and_offset_r17_c_::types");
}
uint16_t sched_request_res_cfg_ext_v1700_s::periodicity_and_offset_r17_c_::types_opts::to_number() const
{
  static const uint16_t numbers[] = {1280, 2560, 5120};
  return map_enum_number(numbers, 3, value, "sched_request_res_cfg_ext_v1700_s::periodicity_and_offset_r17_c_::types");
}

// UCI-OnPUSCH ::= SEQUENCE
SRSASN_CODE uci_on_pusch_s::pack(bit_ref& bref) const
{
  HANDLE_CODE(bref.pack(beta_offsets_present, 1));

  if (beta_offsets_present) {
    HANDLE_CODE(beta_offsets.pack(bref));
  }
  HANDLE_CODE(scaling.pack(bref));

  return SRSASN_SUCCESS;
}
SRSASN_CODE uci_on_pusch_s::unpack(cbit_ref& bref)
{
  HANDLE_CODE(bref.unpack(beta_offsets_present, 1));

  if (beta_offsets_present) {
    HANDLE_CODE(beta_offsets.unpack(bref));
  }
  HANDLE_CODE(scaling.unpack(bref));

  return SRSASN_SUCCESS;
}
void uci_on_pusch_s::to_json(json_writer& j) const
{
  j.start_obj();
  if (beta_offsets_present) {
    j.write_fieldname("betaOffsets");
    beta_offsets.to_json(j);
  }
  j.write_str("scaling", scaling.to_string());
  j.end_obj();
}

void uci_on_pusch_s::beta_offsets_c_::destroy_()
{
  switch (type_) {
    case types::dyn:
      c.destroy<dyn_l_>();
      break;
    case types::semi_static:
      c.destroy<beta_offsets_s>();
      break;
    default:
      break;
  }
}
void uci_on_pusch_s::beta_offsets_c_::set(types::options e)
{
  destroy_();
  type_ = e;
  switch (type_) {
    case types::dyn:
      c.init<dyn_l_>();
      break;
    case types::semi_static:
      c.init<beta_offsets_s>();
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "uci_on_pusch_s::beta_offsets_c_");
  }
}
uci_on_pusch_s::beta_offsets_c_::beta_offsets_c_(const uci_on_pusch_s::beta_offsets_c_& other)
{
  type_ = other.type();
  switch (type_) {
    case types::dyn:
      c.init(other.c.get<dyn_l_>());
      break;
    case types::semi_static:
      c.init(other.c.get<beta_offsets_s>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "uci_on_pusch_s::beta_offsets_c_");
  }
}
uci_on_pusch_s::beta_offsets_c_&
uci_on_pusch_s::beta_offsets_c_::operator=(const uci_on_pusch_s::beta_offsets_c_& other)
{
  if (this == &other) {
    return *this;
  }
  set(other.type());
  switch (type_) {
    case types::dyn:
      c.set(other.c.get<dyn_l_>());
      break;
    case types::semi_static:
      c.set(other.c.get<beta_offsets_s>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "uci_on_pusch_s::beta_offsets_c_");
  }

  return *this;
}
uci_on_pusch_s::beta_offsets_c_::dyn_l_& uci_on_pusch_s::beta_offsets_c_::set_dyn()
{
  set(types::dyn);
  return c.get<dyn_l_>();
}
beta_offsets_s& uci_on_pusch_s::beta_offsets_c_::set_semi_static()
{
  set(types::semi_static);
  return c.get<beta_offsets_s>();
}
void uci_on_pusch_s::beta_offsets_c_::to_json(json_writer& j) const
{
  j.start_obj();
  switch (type_) {
    case types::dyn:
      j.start_array("dynamic");
      for (const auto& e1 : c.get<dyn_l_>()) {
        e1.to_json(j);
      }
      j.end_array();
      break;
    case types::semi_static:
      j.write_fieldname("semiStatic");
      c.get<beta_offsets_s>().to_json(j);
      break;
    default:
      log_invalid_choice_id(type_, "uci_on_pusch_s::beta_offsets_c_");
  }
  j.end_obj();
}
SRSASN_CODE uci_on_pusch_s::beta_offsets_c_::pack(bit_ref& bref) const
{
  type_.pack(bref);
  switch (type_) {
    case types::dyn:
      HANDLE_CODE(pack_fixed_seq_of(bref, c.get<dyn_l_>(), c.get<dyn_l_>().size()));
      break;
    case types::semi_static:
      HANDLE_CODE(c.get<beta_offsets_s>().pack(bref));
      break;
    default:
      log_invalid_choice_id(type_, "uci_on_pusch_s::beta_offsets_c_");
      return SRSASN_ERROR_ENCODE_FAIL;
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE uci_on_pusch_s::beta_offsets_c_::unpack(cbit_ref& bref)
{
  types e;
  e.unpack(bref);
  set(e);
  switch (type_) {
    case types::dyn:
      HANDLE_CODE(unpack_fixed_seq_of(c.get<dyn_l_>(), bref, c.get<dyn_l_>().size()));
      break;
    case types::semi_static:
      HANDLE_CODE(c.get<beta_offsets_s>().unpack(bref));
      break;
    default:
      log_invalid_choice_id(type_, "uci_on_pusch_s::beta_offsets_c_");
      return SRSASN_ERROR_DECODE_FAIL;
  }
  return SRSASN_SUCCESS;
}

const char* uci_on_pusch_s::beta_offsets_c_::types_opts::to_string() const
{
  static const char* names[] = {"dynamic", "semiStatic"};
  return convert_enum_idx(names, 2, value, "uci_on_pusch_s::beta_offsets_c_::types");
}

const char* uci_on_pusch_s::scaling_opts::to_string() const
{
  static const char* names[] = {"f0p5", "f0p65", "f0p8", "f1"};
  return convert_enum_idx(names, 4, value, "uci_on_pusch_s::scaling_e_");
}

// UCI-OnPUSCH-DCI-0-2-r16 ::= SEQUENCE
SRSASN_CODE uci_on_pusch_dci_0_2_r16_s::pack(bit_ref& bref) const
{
  HANDLE_CODE(bref.pack(beta_offsets_dci_0_2_r16_present, 1));

  if (beta_offsets_dci_0_2_r16_present) {
    HANDLE_CODE(beta_offsets_dci_0_2_r16.pack(bref));
  }
  HANDLE_CODE(scaling_dci_0_2_r16.pack(bref));

  return SRSASN_SUCCESS;
}
SRSASN_CODE uci_on_pusch_dci_0_2_r16_s::unpack(cbit_ref& bref)
{
  HANDLE_CODE(bref.unpack(beta_offsets_dci_0_2_r16_present, 1));

  if (beta_offsets_dci_0_2_r16_present) {
    HANDLE_CODE(beta_offsets_dci_0_2_r16.unpack(bref));
  }
  HANDLE_CODE(scaling_dci_0_2_r16.unpack(bref));

  return SRSASN_SUCCESS;
}
void uci_on_pusch_dci_0_2_r16_s::to_json(json_writer& j) const
{
  j.start_obj();
  if (beta_offsets_dci_0_2_r16_present) {
    j.write_fieldname("betaOffsetsDCI-0-2-r16");
    beta_offsets_dci_0_2_r16.to_json(j);
  }
  j.write_str("scalingDCI-0-2-r16", scaling_dci_0_2_r16.to_string());
  j.end_obj();
}

void uci_on_pusch_dci_0_2_r16_s::beta_offsets_dci_0_2_r16_c_::destroy_()
{
  switch (type_) {
    case types::dyn_dci_0_2_r16:
      c.destroy<dyn_dci_0_2_r16_c_>();
      break;
    case types::semi_static_dci_0_2_r16:
      c.destroy<beta_offsets_s>();
      break;
    default:
      break;
  }
}
void uci_on_pusch_dci_0_2_r16_s::beta_offsets_dci_0_2_r16_c_::set(types::options e)
{
  destroy_();
  type_ = e;
  switch (type_) {
    case types::dyn_dci_0_2_r16:
      c.init<dyn_dci_0_2_r16_c_>();
      break;
    case types::semi_static_dci_0_2_r16:
      c.init<beta_offsets_s>();
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "uci_on_pusch_dci_0_2_r16_s::beta_offsets_dci_0_2_r16_c_");
  }
}
uci_on_pusch_dci_0_2_r16_s::beta_offsets_dci_0_2_r16_c_::beta_offsets_dci_0_2_r16_c_(
    const uci_on_pusch_dci_0_2_r16_s::beta_offsets_dci_0_2_r16_c_& other)
{
  type_ = other.type();
  switch (type_) {
    case types::dyn_dci_0_2_r16:
      c.init(other.c.get<dyn_dci_0_2_r16_c_>());
      break;
    case types::semi_static_dci_0_2_r16:
      c.init(other.c.get<beta_offsets_s>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "uci_on_pusch_dci_0_2_r16_s::beta_offsets_dci_0_2_r16_c_");
  }
}
uci_on_pusch_dci_0_2_r16_s::beta_offsets_dci_0_2_r16_c_&
uci_on_pusch_dci_0_2_r16_s::beta_offsets_dci_0_2_r16_c_::operator=(
    const uci_on_pusch_dci_0_2_r16_s::beta_offsets_dci_0_2_r16_c_& other)
{
  if (this == &other) {
    return *this;
  }
  set(other.type());
  switch (type_) {
    case types::dyn_dci_0_2_r16:
      c.set(other.c.get<dyn_dci_0_2_r16_c_>());
      break;
    case types::semi_static_dci_0_2_r16:
      c.set(other.c.get<beta_offsets_s>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "uci_on_pusch_dci_0_2_r16_s::beta_offsets_dci_0_2_r16_c_");
  }

  return *this;
}
uci_on_pusch_dci_0_2_r16_s::beta_offsets_dci_0_2_r16_c_::dyn_dci_0_2_r16_c_&
uci_on_pusch_dci_0_2_r16_s::beta_offsets_dci_0_2_r16_c_::set_dyn_dci_0_2_r16()
{
  set(types::dyn_dci_0_2_r16);
  return c.get<dyn_dci_0_2_r16_c_>();
}
beta_offsets_s& uci_on_pusch_dci_0_2_r16_s::beta_offsets_dci_0_2_r16_c_::set_semi_static_dci_0_2_r16()
{
  set(types::semi_static_dci_0_2_r16);
  return c.get<beta_offsets_s>();
}
void uci_on_pusch_dci_0_2_r16_s::beta_offsets_dci_0_2_r16_c_::to_json(json_writer& j) const
{
  j.start_obj();
  switch (type_) {
    case types::dyn_dci_0_2_r16:
      j.write_fieldname("dynamicDCI-0-2-r16");
      c.get<dyn_dci_0_2_r16_c_>().to_json(j);
      break;
    case types::semi_static_dci_0_2_r16:
      j.write_fieldname("semiStaticDCI-0-2-r16");
      c.get<beta_offsets_s>().to_json(j);
      break;
    default:
      log_invalid_choice_id(type_, "uci_on_pusch_dci_0_2_r16_s::beta_offsets_dci_0_2_r16_c_");
  }
  j.end_obj();
}
SRSASN_CODE uci_on_pusch_dci_0_2_r16_s::beta_offsets_dci_0_2_r16_c_::pack(bit_ref& bref) const
{
  type_.pack(bref);
  switch (type_) {
    case types::dyn_dci_0_2_r16:
      HANDLE_CODE(c.get<dyn_dci_0_2_r16_c_>().pack(bref));
      break;
    case types::semi_static_dci_0_2_r16:
      HANDLE_CODE(c.get<beta_offsets_s>().pack(bref));
      break;
    default:
      log_invalid_choice_id(type_, "uci_on_pusch_dci_0_2_r16_s::beta_offsets_dci_0_2_r16_c_");
      return SRSASN_ERROR_ENCODE_FAIL;
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE uci_on_pusch_dci_0_2_r16_s::beta_offsets_dci_0_2_r16_c_::unpack(cbit_ref& bref)
{
  types e;
  e.unpack(bref);
  set(e);
  switch (type_) {
    case types::dyn_dci_0_2_r16:
      HANDLE_CODE(c.get<dyn_dci_0_2_r16_c_>().unpack(bref));
      break;
    case types::semi_static_dci_0_2_r16:
      HANDLE_CODE(c.get<beta_offsets_s>().unpack(bref));
      break;
    default:
      log_invalid_choice_id(type_, "uci_on_pusch_dci_0_2_r16_s::beta_offsets_dci_0_2_r16_c_");
      return SRSASN_ERROR_DECODE_FAIL;
  }
  return SRSASN_SUCCESS;
}

void uci_on_pusch_dci_0_2_r16_s::beta_offsets_dci_0_2_r16_c_::dyn_dci_0_2_r16_c_::destroy_()
{
  switch (type_) {
    case types::one_bit_r16:
      c.destroy<one_bit_r16_l_>();
      break;
    case types::two_bits_r16:
      c.destroy<two_bits_r16_l_>();
      break;
    default:
      break;
  }
}
void uci_on_pusch_dci_0_2_r16_s::beta_offsets_dci_0_2_r16_c_::dyn_dci_0_2_r16_c_::set(types::options e)
{
  destroy_();
  type_ = e;
  switch (type_) {
    case types::one_bit_r16:
      c.init<one_bit_r16_l_>();
      break;
    case types::two_bits_r16:
      c.init<two_bits_r16_l_>();
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "uci_on_pusch_dci_0_2_r16_s::beta_offsets_dci_0_2_r16_c_::dyn_dci_0_2_r16_c_");
  }
}
uci_on_pusch_dci_0_2_r16_s::beta_offsets_dci_0_2_r16_c_::dyn_dci_0_2_r16_c_::dyn_dci_0_2_r16_c_(
    const uci_on_pusch_dci_0_2_r16_s::beta_offsets_dci_0_2_r16_c_::dyn_dci_0_2_r16_c_& other)
{
  type_ = other.type();
  switch (type_) {
    case types::one_bit_r16:
      c.init(other.c.get<one_bit_r16_l_>());
      break;
    case types::two_bits_r16:
      c.init(other.c.get<two_bits_r16_l_>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "uci_on_pusch_dci_0_2_r16_s::beta_offsets_dci_0_2_r16_c_::dyn_dci_0_2_r16_c_");
  }
}
uci_on_pusch_dci_0_2_r16_s::beta_offsets_dci_0_2_r16_c_::dyn_dci_0_2_r16_c_&
uci_on_pusch_dci_0_2_r16_s::beta_offsets_dci_0_2_r16_c_::dyn_dci_0_2_r16_c_::operator=(
    const uci_on_pusch_dci_0_2_r16_s::beta_offsets_dci_0_2_r16_c_::dyn_dci_0_2_r16_c_& other)
{
  if (this == &other) {
    return *this;
  }
  set(other.type());
  switch (type_) {
    case types::one_bit_r16:
      c.set(other.c.get<one_bit_r16_l_>());
      break;
    case types::two_bits_r16:
      c.set(other.c.get<two_bits_r16_l_>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "uci_on_pusch_dci_0_2_r16_s::beta_offsets_dci_0_2_r16_c_::dyn_dci_0_2_r16_c_");
  }

  return *this;
}
uci_on_pusch_dci_0_2_r16_s::beta_offsets_dci_0_2_r16_c_::dyn_dci_0_2_r16_c_::one_bit_r16_l_&
uci_on_pusch_dci_0_2_r16_s::beta_offsets_dci_0_2_r16_c_::dyn_dci_0_2_r16_c_::set_one_bit_r16()
{
  set(types::one_bit_r16);
  return c.get<one_bit_r16_l_>();
}
uci_on_pusch_dci_0_2_r16_s::beta_offsets_dci_0_2_r16_c_::dyn_dci_0_2_r16_c_::two_bits_r16_l_&
uci_on_pusch_dci_0_2_r16_s::beta_offsets_dci_0_2_r16_c_::dyn_dci_0_2_r16_c_::set_two_bits_r16()
{
  set(types::two_bits_r16);
  return c.get<two_bits_r16_l_>();
}
void uci_on_pusch_dci_0_2_r16_s::beta_offsets_dci_0_2_r16_c_::dyn_dci_0_2_r16_c_::to_json(json_writer& j) const
{
  j.start_obj();
  switch (type_) {
    case types::one_bit_r16:
      j.start_array("oneBit-r16");
      for (const auto& e1 : c.get<one_bit_r16_l_>()) {
        e1.to_json(j);
      }
      j.end_array();
      break;
    case types::two_bits_r16:
      j.start_array("twoBits-r16");
      for (const auto& e1 : c.get<two_bits_r16_l_>()) {
        e1.to_json(j);
      }
      j.end_array();
      break;
    default:
      log_invalid_choice_id(type_, "uci_on_pusch_dci_0_2_r16_s::beta_offsets_dci_0_2_r16_c_::dyn_dci_0_2_r16_c_");
  }
  j.end_obj();
}
SRSASN_CODE uci_on_pusch_dci_0_2_r16_s::beta_offsets_dci_0_2_r16_c_::dyn_dci_0_2_r16_c_::pack(bit_ref& bref) const
{
  type_.pack(bref);
  switch (type_) {
    case types::one_bit_r16:
      HANDLE_CODE(pack_fixed_seq_of(bref, c.get<one_bit_r16_l_>(), c.get<one_bit_r16_l_>().size()));
      break;
    case types::two_bits_r16:
      HANDLE_CODE(pack_fixed_seq_of(bref, c.get<two_bits_r16_l_>(), c.get<two_bits_r16_l_>().size()));
      break;
    default:
      log_invalid_choice_id(type_, "uci_on_pusch_dci_0_2_r16_s::beta_offsets_dci_0_2_r16_c_::dyn_dci_0_2_r16_c_");
      return SRSASN_ERROR_ENCODE_FAIL;
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE uci_on_pusch_dci_0_2_r16_s::beta_offsets_dci_0_2_r16_c_::dyn_dci_0_2_r16_c_::unpack(cbit_ref& bref)
{
  types e;
  e.unpack(bref);
  set(e);
  switch (type_) {
    case types::one_bit_r16:
      HANDLE_CODE(unpack_fixed_seq_of(c.get<one_bit_r16_l_>(), bref, c.get<one_bit_r16_l_>().size()));
      break;
    case types::two_bits_r16:
      HANDLE_CODE(unpack_fixed_seq_of(c.get<two_bits_r16_l_>(), bref, c.get<two_bits_r16_l_>().size()));
      break;
    default:
      log_invalid_choice_id(type_, "uci_on_pusch_dci_0_2_r16_s::beta_offsets_dci_0_2_r16_c_::dyn_dci_0_2_r16_c_");
      return SRSASN_ERROR_DECODE_FAIL;
  }
  return SRSASN_SUCCESS;
}

const char* uci_on_pusch_dci_0_2_r16_s::beta_offsets_dci_0_2_r16_c_::dyn_dci_0_2_r16_c_::types_opts::to_string() const
{
  static const char* names[] = {"oneBit-r16", "twoBits-r16"};
  return convert_enum_idx(
      names, 2, value, "uci_on_pusch_dci_0_2_r16_s::beta_offsets_dci_0_2_r16_c_::dyn_dci_0_2_r16_c_::types");
}
uint8_t uci_on_pusch_dci_0_2_r16_s::beta_offsets_dci_0_2_r16_c_::dyn_dci_0_2_r16_c_::types_opts::to_number() const
{
  static const uint8_t numbers[] = {1, 2};
  return map_enum_number(
      numbers, 2, value, "uci_on_pusch_dci_0_2_r16_s::beta_offsets_dci_0_2_r16_c_::dyn_dci_0_2_r16_c_::types");
}

const char* uci_on_pusch_dci_0_2_r16_s::beta_offsets_dci_0_2_r16_c_::types_opts::to_string() const
{
  static const char* names[] = {"dynamicDCI-0-2-r16", "semiStaticDCI-0-2-r16"};
  return convert_enum_idx(names, 2, value, "uci_on_pusch_dci_0_2_r16_s::beta_offsets_dci_0_2_r16_c_::types");
}

const char* uci_on_pusch_dci_0_2_r16_s::scaling_dci_0_2_r16_opts::to_string() const
{
  static const char* names[] = {"f0p5", "f0p65", "f0p8", "f1"};
  return convert_enum_idx(names, 4, value, "uci_on_pusch_dci_0_2_r16_s::scaling_dci_0_2_r16_e_");
}

// BetaOffsetsCrossPriSel-r17 ::= CHOICE
void beta_offsets_cross_pri_sel_r17_c::destroy_()
{
  switch (type_) {
    case types::dyn_r17:
      c.destroy<dyn_r17_l_>();
      break;
    case types::semi_static_r17:
      c.destroy<beta_offsets_cross_pri_r17_l>();
      break;
    default:
      break;
  }
}
void beta_offsets_cross_pri_sel_r17_c::set(types::options e)
{
  destroy_();
  type_ = e;
  switch (type_) {
    case types::dyn_r17:
      c.init<dyn_r17_l_>();
      break;
    case types::semi_static_r17:
      c.init<beta_offsets_cross_pri_r17_l>();
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "beta_offsets_cross_pri_sel_r17_c");
  }
}
beta_offsets_cross_pri_sel_r17_c::beta_offsets_cross_pri_sel_r17_c(const beta_offsets_cross_pri_sel_r17_c& other)
{
  type_ = other.type();
  switch (type_) {
    case types::dyn_r17:
      c.init(other.c.get<dyn_r17_l_>());
      break;
    case types::semi_static_r17:
      c.init(other.c.get<beta_offsets_cross_pri_r17_l>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "beta_offsets_cross_pri_sel_r17_c");
  }
}
beta_offsets_cross_pri_sel_r17_c&
beta_offsets_cross_pri_sel_r17_c::operator=(const beta_offsets_cross_pri_sel_r17_c& other)
{
  if (this == &other) {
    return *this;
  }
  set(other.type());
  switch (type_) {
    case types::dyn_r17:
      c.set(other.c.get<dyn_r17_l_>());
      break;
    case types::semi_static_r17:
      c.set(other.c.get<beta_offsets_cross_pri_r17_l>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "beta_offsets_cross_pri_sel_r17_c");
  }

  return *this;
}
beta_offsets_cross_pri_sel_r17_c::dyn_r17_l_& beta_offsets_cross_pri_sel_r17_c::set_dyn_r17()
{
  set(types::dyn_r17);
  return c.get<dyn_r17_l_>();
}
beta_offsets_cross_pri_r17_l& beta_offsets_cross_pri_sel_r17_c::set_semi_static_r17()
{
  set(types::semi_static_r17);
  return c.get<beta_offsets_cross_pri_r17_l>();
}
void beta_offsets_cross_pri_sel_r17_c::to_json(json_writer& j) const
{
  j.start_obj();
  switch (type_) {
    case types::dyn_r17:
      j.start_array("dynamic-r17");
      for (const auto& e1 : c.get<dyn_r17_l_>()) {
        j.start_array();
        for (const auto& e2 : e1) {
          j.write_int(e2);
        }
        j.end_array();
      }
      j.end_array();
      break;
    case types::semi_static_r17:
      j.start_array("semiStatic-r17");
      for (const auto& e1 : c.get<beta_offsets_cross_pri_r17_l>()) {
        j.write_int(e1);
      }
      j.end_array();
      break;
    default:
      log_invalid_choice_id(type_, "beta_offsets_cross_pri_sel_r17_c");
  }
  j.end_obj();
}
SRSASN_CODE beta_offsets_cross_pri_sel_r17_c::pack(bit_ref& bref) const
{
  type_.pack(bref);
  switch (type_) {
    case types::dyn_r17:
      HANDLE_CODE(pack_fixed_seq_of(bref,
                                    c.get<dyn_r17_l_>(),
                                    c.get<dyn_r17_l_>().size(),
                                    FixedSeqOfPacker<integer_packer<uint8_t>>(3, integer_packer<uint8_t>(0, 31))));
      break;
    case types::semi_static_r17:
      HANDLE_CODE(pack_fixed_seq_of(bref,
                                    c.get<beta_offsets_cross_pri_r17_l>(),
                                    c.get<beta_offsets_cross_pri_r17_l>().size(),
                                    integer_packer<uint8_t>(0, 31)));
      break;
    default:
      log_invalid_choice_id(type_, "beta_offsets_cross_pri_sel_r17_c");
      return SRSASN_ERROR_ENCODE_FAIL;
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE beta_offsets_cross_pri_sel_r17_c::unpack(cbit_ref& bref)
{
  types e;
  e.unpack(bref);
  set(e);
  switch (type_) {
    case types::dyn_r17:
      HANDLE_CODE(unpack_fixed_seq_of(c.get<dyn_r17_l_>(),
                                      bref,
                                      c.get<dyn_r17_l_>().size(),
                                      FixedSeqOfPacker<integer_packer<uint8_t>>(3, integer_packer<uint8_t>(0, 31))));
      break;
    case types::semi_static_r17:
      HANDLE_CODE(unpack_fixed_seq_of(c.get<beta_offsets_cross_pri_r17_l>(),
                                      bref,
                                      c.get<beta_offsets_cross_pri_r17_l>().size(),
                                      integer_packer<uint8_t>(0, 31)));
      break;
    default:
      log_invalid_choice_id(type_, "beta_offsets_cross_pri_sel_r17_c");
      return SRSASN_ERROR_DECODE_FAIL;
  }
  return SRSASN_SUCCESS;
}

const char* beta_offsets_cross_pri_sel_r17_c::types_opts::to_string() const
{
  static const char* names[] = {"dynamic-r17", "semiStatic-r17"};
  return convert_enum_idx(names, 2, value, "beta_offsets_cross_pri_sel_r17_c::types");
}

// BetaOffsetsCrossPriSelDCI-0-2-r17 ::= CHOICE
void beta_offsets_cross_pri_sel_dci_0_2_r17_c::destroy_()
{
  switch (type_) {
    case types::dyn_dci_0_2_r17:
      c.destroy<dyn_dci_0_2_r17_c_>();
      break;
    case types::semi_static_dci_0_2_r17:
      c.destroy<beta_offsets_cross_pri_r17_l>();
      break;
    default:
      break;
  }
}
void beta_offsets_cross_pri_sel_dci_0_2_r17_c::set(types::options e)
{
  destroy_();
  type_ = e;
  switch (type_) {
    case types::dyn_dci_0_2_r17:
      c.init<dyn_dci_0_2_r17_c_>();
      break;
    case types::semi_static_dci_0_2_r17:
      c.init<beta_offsets_cross_pri_r17_l>();
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "beta_offsets_cross_pri_sel_dci_0_2_r17_c");
  }
}
beta_offsets_cross_pri_sel_dci_0_2_r17_c::beta_offsets_cross_pri_sel_dci_0_2_r17_c(
    const beta_offsets_cross_pri_sel_dci_0_2_r17_c& other)
{
  type_ = other.type();
  switch (type_) {
    case types::dyn_dci_0_2_r17:
      c.init(other.c.get<dyn_dci_0_2_r17_c_>());
      break;
    case types::semi_static_dci_0_2_r17:
      c.init(other.c.get<beta_offsets_cross_pri_r17_l>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "beta_offsets_cross_pri_sel_dci_0_2_r17_c");
  }
}
beta_offsets_cross_pri_sel_dci_0_2_r17_c&
beta_offsets_cross_pri_sel_dci_0_2_r17_c::operator=(const beta_offsets_cross_pri_sel_dci_0_2_r17_c& other)
{
  if (this == &other) {
    return *this;
  }
  set(other.type());
  switch (type_) {
    case types::dyn_dci_0_2_r17:
      c.set(other.c.get<dyn_dci_0_2_r17_c_>());
      break;
    case types::semi_static_dci_0_2_r17:
      c.set(other.c.get<beta_offsets_cross_pri_r17_l>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "beta_offsets_cross_pri_sel_dci_0_2_r17_c");
  }

  return *this;
}
beta_offsets_cross_pri_sel_dci_0_2_r17_c::dyn_dci_0_2_r17_c_&
beta_offsets_cross_pri_sel_dci_0_2_r17_c::set_dyn_dci_0_2_r17()
{
  set(types::dyn_dci_0_2_r17);
  return c.get<dyn_dci_0_2_r17_c_>();
}
beta_offsets_cross_pri_r17_l& beta_offsets_cross_pri_sel_dci_0_2_r17_c::set_semi_static_dci_0_2_r17()
{
  set(types::semi_static_dci_0_2_r17);
  return c.get<beta_offsets_cross_pri_r17_l>();
}
void beta_offsets_cross_pri_sel_dci_0_2_r17_c::to_json(json_writer& j) const
{
  j.start_obj();
  switch (type_) {
    case types::dyn_dci_0_2_r17:
      j.write_fieldname("dynamicDCI-0-2-r17");
      c.get<dyn_dci_0_2_r17_c_>().to_json(j);
      break;
    case types::semi_static_dci_0_2_r17:
      j.start_array("semiStaticDCI-0-2-r17");
      for (const auto& e1 : c.get<beta_offsets_cross_pri_r17_l>()) {
        j.write_int(e1);
      }
      j.end_array();
      break;
    default:
      log_invalid_choice_id(type_, "beta_offsets_cross_pri_sel_dci_0_2_r17_c");
  }
  j.end_obj();
}
SRSASN_CODE beta_offsets_cross_pri_sel_dci_0_2_r17_c::pack(bit_ref& bref) const
{
  type_.pack(bref);
  switch (type_) {
    case types::dyn_dci_0_2_r17:
      HANDLE_CODE(c.get<dyn_dci_0_2_r17_c_>().pack(bref));
      break;
    case types::semi_static_dci_0_2_r17:
      HANDLE_CODE(pack_fixed_seq_of(bref,
                                    c.get<beta_offsets_cross_pri_r17_l>(),
                                    c.get<beta_offsets_cross_pri_r17_l>().size(),
                                    integer_packer<uint8_t>(0, 31)));
      break;
    default:
      log_invalid_choice_id(type_, "beta_offsets_cross_pri_sel_dci_0_2_r17_c");
      return SRSASN_ERROR_ENCODE_FAIL;
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE beta_offsets_cross_pri_sel_dci_0_2_r17_c::unpack(cbit_ref& bref)
{
  types e;
  e.unpack(bref);
  set(e);
  switch (type_) {
    case types::dyn_dci_0_2_r17:
      HANDLE_CODE(c.get<dyn_dci_0_2_r17_c_>().unpack(bref));
      break;
    case types::semi_static_dci_0_2_r17:
      HANDLE_CODE(unpack_fixed_seq_of(c.get<beta_offsets_cross_pri_r17_l>(),
                                      bref,
                                      c.get<beta_offsets_cross_pri_r17_l>().size(),
                                      integer_packer<uint8_t>(0, 31)));
      break;
    default:
      log_invalid_choice_id(type_, "beta_offsets_cross_pri_sel_dci_0_2_r17_c");
      return SRSASN_ERROR_DECODE_FAIL;
  }
  return SRSASN_SUCCESS;
}

void beta_offsets_cross_pri_sel_dci_0_2_r17_c::dyn_dci_0_2_r17_c_::destroy_()
{
  switch (type_) {
    case types::one_bit_r17:
      c.destroy<one_bit_r17_l_>();
      break;
    case types::two_bits_r17:
      c.destroy<two_bits_r17_l_>();
      break;
    default:
      break;
  }
}
void beta_offsets_cross_pri_sel_dci_0_2_r17_c::dyn_dci_0_2_r17_c_::set(types::options e)
{
  destroy_();
  type_ = e;
  switch (type_) {
    case types::one_bit_r17:
      c.init<one_bit_r17_l_>();
      break;
    case types::two_bits_r17:
      c.init<two_bits_r17_l_>();
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "beta_offsets_cross_pri_sel_dci_0_2_r17_c::dyn_dci_0_2_r17_c_");
  }
}
beta_offsets_cross_pri_sel_dci_0_2_r17_c::dyn_dci_0_2_r17_c_::dyn_dci_0_2_r17_c_(
    const beta_offsets_cross_pri_sel_dci_0_2_r17_c::dyn_dci_0_2_r17_c_& other)
{
  type_ = other.type();
  switch (type_) {
    case types::one_bit_r17:
      c.init(other.c.get<one_bit_r17_l_>());
      break;
    case types::two_bits_r17:
      c.init(other.c.get<two_bits_r17_l_>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "beta_offsets_cross_pri_sel_dci_0_2_r17_c::dyn_dci_0_2_r17_c_");
  }
}
beta_offsets_cross_pri_sel_dci_0_2_r17_c::dyn_dci_0_2_r17_c_&
beta_offsets_cross_pri_sel_dci_0_2_r17_c::dyn_dci_0_2_r17_c_::operator=(
    const beta_offsets_cross_pri_sel_dci_0_2_r17_c::dyn_dci_0_2_r17_c_& other)
{
  if (this == &other) {
    return *this;
  }
  set(other.type());
  switch (type_) {
    case types::one_bit_r17:
      c.set(other.c.get<one_bit_r17_l_>());
      break;
    case types::two_bits_r17:
      c.set(other.c.get<two_bits_r17_l_>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "beta_offsets_cross_pri_sel_dci_0_2_r17_c::dyn_dci_0_2_r17_c_");
  }

  return *this;
}
beta_offsets_cross_pri_sel_dci_0_2_r17_c::dyn_dci_0_2_r17_c_::one_bit_r17_l_&
beta_offsets_cross_pri_sel_dci_0_2_r17_c::dyn_dci_0_2_r17_c_::set_one_bit_r17()
{
  set(types::one_bit_r17);
  return c.get<one_bit_r17_l_>();
}
beta_offsets_cross_pri_sel_dci_0_2_r17_c::dyn_dci_0_2_r17_c_::two_bits_r17_l_&
beta_offsets_cross_pri_sel_dci_0_2_r17_c::dyn_dci_0_2_r17_c_::set_two_bits_r17()
{
  set(types::two_bits_r17);
  return c.get<two_bits_r17_l_>();
}
void beta_offsets_cross_pri_sel_dci_0_2_r17_c::dyn_dci_0_2_r17_c_::to_json(json_writer& j) const
{
  j.start_obj();
  switch (type_) {
    case types::one_bit_r17:
      j.start_array("oneBit-r17");
      for (const auto& e1 : c.get<one_bit_r17_l_>()) {
        j.start_array();
        for (const auto& e2 : e1) {
          j.write_int(e2);
        }
        j.end_array();
      }
      j.end_array();
      break;
    case types::two_bits_r17:
      j.start_array("twoBits-r17");
      for (const auto& e1 : c.get<two_bits_r17_l_>()) {
        j.start_array();
        for (const auto& e2 : e1) {
          j.write_int(e2);
        }
        j.end_array();
      }
      j.end_array();
      break;
    default:
      log_invalid_choice_id(type_, "beta_offsets_cross_pri_sel_dci_0_2_r17_c::dyn_dci_0_2_r17_c_");
  }
  j.end_obj();
}
SRSASN_CODE beta_offsets_cross_pri_sel_dci_0_2_r17_c::dyn_dci_0_2_r17_c_::pack(bit_ref& bref) const
{
  type_.pack(bref);
  switch (type_) {
    case types::one_bit_r17:
      HANDLE_CODE(pack_fixed_seq_of(bref,
                                    c.get<one_bit_r17_l_>(),
                                    c.get<one_bit_r17_l_>().size(),
                                    FixedSeqOfPacker<integer_packer<uint8_t>>(3, integer_packer<uint8_t>(0, 31))));
      break;
    case types::two_bits_r17:
      HANDLE_CODE(pack_fixed_seq_of(bref,
                                    c.get<two_bits_r17_l_>(),
                                    c.get<two_bits_r17_l_>().size(),
                                    FixedSeqOfPacker<integer_packer<uint8_t>>(3, integer_packer<uint8_t>(0, 31))));
      break;
    default:
      log_invalid_choice_id(type_, "beta_offsets_cross_pri_sel_dci_0_2_r17_c::dyn_dci_0_2_r17_c_");
      return SRSASN_ERROR_ENCODE_FAIL;
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE beta_offsets_cross_pri_sel_dci_0_2_r17_c::dyn_dci_0_2_r17_c_::unpack(cbit_ref& bref)
{
  types e;
  e.unpack(bref);
  set(e);
  switch (type_) {
    case types::one_bit_r17:
      HANDLE_CODE(unpack_fixed_seq_of(c.get<one_bit_r17_l_>(),
                                      bref,
                                      c.get<one_bit_r17_l_>().size(),
                                      FixedSeqOfPacker<integer_packer<uint8_t>>(3, integer_packer<uint8_t>(0, 31))));
      break;
    case types::two_bits_r17:
      HANDLE_CODE(unpack_fixed_seq_of(c.get<two_bits_r17_l_>(),
                                      bref,
                                      c.get<two_bits_r17_l_>().size(),
                                      FixedSeqOfPacker<integer_packer<uint8_t>>(3, integer_packer<uint8_t>(0, 31))));
      break;
    default:
      log_invalid_choice_id(type_, "beta_offsets_cross_pri_sel_dci_0_2_r17_c::dyn_dci_0_2_r17_c_");
      return SRSASN_ERROR_DECODE_FAIL;
  }
  return SRSASN_SUCCESS;
}

const char* beta_offsets_cross_pri_sel_dci_0_2_r17_c::dyn_dci_0_2_r17_c_::types_opts::to_string() const
{
  static const char* names[] = {"oneBit-r17", "twoBits-r17"};
  return convert_enum_idx(names, 2, value, "beta_offsets_cross_pri_sel_dci_0_2_r17_c::dyn_dci_0_2_r17_c_::types");
}
uint8_t beta_offsets_cross_pri_sel_dci_0_2_r17_c::dyn_dci_0_2_r17_c_::types_opts::to_number() const
{
  static const uint8_t numbers[] = {1, 2};
  return map_enum_number(numbers, 2, value, "beta_offsets_cross_pri_sel_dci_0_2_r17_c::dyn_dci_0_2_r17_c_::types");
}

const char* beta_offsets_cross_pri_sel_dci_0_2_r17_c::types_opts::to_string() const
{
  static const char* names[] = {"dynamicDCI-0-2-r17", "semiStaticDCI-0-2-r17"};
  return convert_enum_idx(names, 2, value, "beta_offsets_cross_pri_sel_dci_0_2_r17_c::types");
}

// ConfiguredGrantConfig ::= SEQUENCE
SRSASN_CODE cfg_grant_cfg_s::pack(bit_ref& bref) const
{
  bref.pack(ext, 1);
  HANDLE_CODE(bref.pack(freq_hop_present, 1));
  HANDLE_CODE(bref.pack(mcs_table_present, 1));
  HANDLE_CODE(bref.pack(mcs_table_transform_precoder_present, 1));
  HANDLE_CODE(bref.pack(uci_on_pusch_present, 1));
  HANDLE_CODE(bref.pack(rbg_size_present, 1));
  HANDLE_CODE(bref.pack(transform_precoder_present, 1));
  HANDLE_CODE(bref.pack(rep_k_rv_present, 1));
  HANDLE_CODE(bref.pack(cfg_grant_timer_present, 1));
  HANDLE_CODE(bref.pack(rrc_cfg_ul_grant_present, 1));

  if (freq_hop_present) {
    HANDLE_CODE(freq_hop.pack(bref));
  }
  HANDLE_CODE(cg_dmrs_cfg.pack(bref));
  if (mcs_table_present) {
    HANDLE_CODE(mcs_table.pack(bref));
  }
  if (mcs_table_transform_precoder_present) {
    HANDLE_CODE(mcs_table_transform_precoder.pack(bref));
  }
  if (uci_on_pusch_present) {
    HANDLE_CODE(uci_on_pusch.pack(bref));
  }
  HANDLE_CODE(res_alloc.pack(bref));
  HANDLE_CODE(pwr_ctrl_loop_to_use.pack(bref));
  HANDLE_CODE(pack_integer(bref, p0_pusch_alpha, (uint8_t)0u, (uint8_t)29u));
  if (transform_precoder_present) {
    HANDLE_CODE(transform_precoder.pack(bref));
  }
  HANDLE_CODE(pack_integer(bref, nrof_harq_processes, (uint8_t)1u, (uint8_t)16u));
  HANDLE_CODE(rep_k.pack(bref));
  if (rep_k_rv_present) {
    HANDLE_CODE(rep_k_rv.pack(bref));
  }
  HANDLE_CODE(periodicity.pack(bref));
  if (cfg_grant_timer_present) {
    HANDLE_CODE(pack_integer(bref, cfg_grant_timer, (uint8_t)1u, (uint8_t)64u));
  }
  if (rrc_cfg_ul_grant_present) {
    HANDLE_CODE(rrc_cfg_ul_grant.pack(bref));
  }

  if (ext) {
    ext_groups_packer_guard group_flags;
    group_flags[0] |= cg_retx_timer_r16_present;
    group_flags[0] |= cg_min_dfi_delay_r16_present;
    group_flags[0] |= cg_nrof_pusch_in_slot_r16_present;
    group_flags[0] |= cg_nrof_slots_r16_present;
    group_flags[0] |= cg_start_offsets_r16.is_present();
    group_flags[0] |= cg_uci_mux_r16_present;
    group_flags[0] |= cg_cot_sharing_offset_r16_present;
    group_flags[0] |= beta_offset_cg_uci_r16_present;
    group_flags[0] |= cg_cot_sharing_list_r16.is_present();
    group_flags[0] |= harq_proc_id_offset_r16_present;
    group_flags[0] |= harq_proc_id_offset2_r16_present;
    group_flags[0] |= cfg_grant_cfg_idx_r16_present;
    group_flags[0] |= cfg_grant_cfg_idx_mac_r16_present;
    group_flags[0] |= periodicity_ext_r16_present;
    group_flags[0] |= start_from_rv0_r16_present;
    group_flags[0] |= phy_prio_idx_r16_present;
    group_flags[0] |= autonomous_tx_r16_present;
    group_flags[1] |= cg_beta_offsets_cross_pri0_r17.is_present();
    group_flags[1] |= cg_beta_offsets_cross_pri1_r17.is_present();
    group_flags[1] |= map_pattern_r17_present;
    group_flags[1] |= seq_offset_for_rv_r17_present;
    group_flags[1] |= p0_pusch_alpha2_r17_present;
    group_flags[1] |= pwr_ctrl_loop_to_use2_r17_present;
    group_flags[1] |= cg_cot_sharing_list_r17.is_present();
    group_flags[1] |= periodicity_ext_r17_present;
    group_flags[1] |= rep_k_v1710_present;
    group_flags[1] |= nrof_harq_processes_v1700_present;
    group_flags[1] |= harq_proc_id_offset2_v1700_present;
    group_flags[1] |= cfg_grant_timer_v1700_present;
    group_flags[1] |= cg_min_dfi_delay_v1710_present;
    group_flags[2] |= harq_proc_id_offset_v1730_present;
    group_flags[2] |= cg_nrof_slots_r17_present;
    group_flags.pack(bref);

    if (group_flags[0]) {
      varlength_field_pack_guard varlen_scope(bref, false);

      HANDLE_CODE(bref.pack(cg_retx_timer_r16_present, 1));
      HANDLE_CODE(bref.pack(cg_min_dfi_delay_r16_present, 1));
      HANDLE_CODE(bref.pack(cg_nrof_pusch_in_slot_r16_present, 1));
      HANDLE_CODE(bref.pack(cg_nrof_slots_r16_present, 1));
      HANDLE_CODE(bref.pack(cg_start_offsets_r16.is_present(), 1));
      HANDLE_CODE(bref.pack(cg_uci_mux_r16_present, 1));
      HANDLE_CODE(bref.pack(cg_cot_sharing_offset_r16_present, 1));
      HANDLE_CODE(bref.pack(beta_offset_cg_uci_r16_present, 1));
      HANDLE_CODE(bref.pack(cg_cot_sharing_list_r16.is_present(), 1));
      HANDLE_CODE(bref.pack(harq_proc_id_offset_r16_present, 1));
      HANDLE_CODE(bref.pack(harq_proc_id_offset2_r16_present, 1));
      HANDLE_CODE(bref.pack(cfg_grant_cfg_idx_r16_present, 1));
      HANDLE_CODE(bref.pack(cfg_grant_cfg_idx_mac_r16_present, 1));
      HANDLE_CODE(bref.pack(periodicity_ext_r16_present, 1));
      HANDLE_CODE(bref.pack(start_from_rv0_r16_present, 1));
      HANDLE_CODE(bref.pack(phy_prio_idx_r16_present, 1));
      HANDLE_CODE(bref.pack(autonomous_tx_r16_present, 1));
      if (cg_retx_timer_r16_present) {
        HANDLE_CODE(pack_integer(bref, cg_retx_timer_r16, (uint8_t)1u, (uint8_t)64u));
      }
      if (cg_min_dfi_delay_r16_present) {
        HANDLE_CODE(cg_min_dfi_delay_r16.pack(bref));
      }
      if (cg_nrof_pusch_in_slot_r16_present) {
        HANDLE_CODE(pack_integer(bref, cg_nrof_pusch_in_slot_r16, (uint8_t)1u, (uint8_t)7u));
      }
      if (cg_nrof_slots_r16_present) {
        HANDLE_CODE(pack_integer(bref, cg_nrof_slots_r16, (uint8_t)1u, (uint8_t)40u));
      }
      if (cg_start_offsets_r16.is_present()) {
        HANDLE_CODE(cg_start_offsets_r16->pack(bref));
      }
      if (cg_cot_sharing_offset_r16_present) {
        HANDLE_CODE(pack_integer(bref, cg_cot_sharing_offset_r16, (uint8_t)1u, (uint8_t)39u));
      }
      if (beta_offset_cg_uci_r16_present) {
        HANDLE_CODE(pack_integer(bref, beta_offset_cg_uci_r16, (uint8_t)0u, (uint8_t)31u));
      }
      if (cg_cot_sharing_list_r16.is_present()) {
        HANDLE_CODE(pack_dyn_seq_of(bref, *cg_cot_sharing_list_r16, 1, 1709));
      }
      if (harq_proc_id_offset_r16_present) {
        HANDLE_CODE(pack_integer(bref, harq_proc_id_offset_r16, (uint8_t)0u, (uint8_t)15u));
      }
      if (harq_proc_id_offset2_r16_present) {
        HANDLE_CODE(pack_integer(bref, harq_proc_id_offset2_r16, (uint8_t)0u, (uint8_t)15u));
      }
      if (cfg_grant_cfg_idx_r16_present) {
        HANDLE_CODE(pack_integer(bref, cfg_grant_cfg_idx_r16, (uint8_t)0u, (uint8_t)11u));
      }
      if (cfg_grant_cfg_idx_mac_r16_present) {
        HANDLE_CODE(pack_integer(bref, cfg_grant_cfg_idx_mac_r16, (uint8_t)0u, (uint8_t)31u));
      }
      if (periodicity_ext_r16_present) {
        HANDLE_CODE(pack_integer(bref, periodicity_ext_r16, (uint16_t)1u, (uint16_t)5120u));
      }
      if (start_from_rv0_r16_present) {
        HANDLE_CODE(start_from_rv0_r16.pack(bref));
      }
      if (phy_prio_idx_r16_present) {
        HANDLE_CODE(phy_prio_idx_r16.pack(bref));
      }
    }
    if (group_flags[1]) {
      varlength_field_pack_guard varlen_scope(bref, false);

      HANDLE_CODE(bref.pack(cg_beta_offsets_cross_pri0_r17.is_present(), 1));
      HANDLE_CODE(bref.pack(cg_beta_offsets_cross_pri1_r17.is_present(), 1));
      HANDLE_CODE(bref.pack(map_pattern_r17_present, 1));
      HANDLE_CODE(bref.pack(seq_offset_for_rv_r17_present, 1));
      HANDLE_CODE(bref.pack(p0_pusch_alpha2_r17_present, 1));
      HANDLE_CODE(bref.pack(pwr_ctrl_loop_to_use2_r17_present, 1));
      HANDLE_CODE(bref.pack(cg_cot_sharing_list_r17.is_present(), 1));
      HANDLE_CODE(bref.pack(periodicity_ext_r17_present, 1));
      HANDLE_CODE(bref.pack(rep_k_v1710_present, 1));
      HANDLE_CODE(bref.pack(nrof_harq_processes_v1700_present, 1));
      HANDLE_CODE(bref.pack(harq_proc_id_offset2_v1700_present, 1));
      HANDLE_CODE(bref.pack(cfg_grant_timer_v1700_present, 1));
      HANDLE_CODE(bref.pack(cg_min_dfi_delay_v1710_present, 1));
      if (cg_beta_offsets_cross_pri0_r17.is_present()) {
        HANDLE_CODE(cg_beta_offsets_cross_pri0_r17->pack(bref));
      }
      if (cg_beta_offsets_cross_pri1_r17.is_present()) {
        HANDLE_CODE(cg_beta_offsets_cross_pri1_r17->pack(bref));
      }
      if (map_pattern_r17_present) {
        HANDLE_CODE(map_pattern_r17.pack(bref));
      }
      if (seq_offset_for_rv_r17_present) {
        HANDLE_CODE(pack_integer(bref, seq_offset_for_rv_r17, (uint8_t)0u, (uint8_t)3u));
      }
      if (p0_pusch_alpha2_r17_present) {
        HANDLE_CODE(pack_integer(bref, p0_pusch_alpha2_r17, (uint8_t)0u, (uint8_t)29u));
      }
      if (pwr_ctrl_loop_to_use2_r17_present) {
        HANDLE_CODE(pwr_ctrl_loop_to_use2_r17.pack(bref));
      }
      if (cg_cot_sharing_list_r17.is_present()) {
        HANDLE_CODE(pack_dyn_seq_of(bref, *cg_cot_sharing_list_r17, 1, 50722));
      }
      if (periodicity_ext_r17_present) {
        HANDLE_CODE(pack_integer(bref, periodicity_ext_r17, (uint16_t)1u, (uint16_t)40960u));
      }
      if (rep_k_v1710_present) {
        HANDLE_CODE(rep_k_v1710.pack(bref));
      }
      if (nrof_harq_processes_v1700_present) {
        HANDLE_CODE(pack_integer(bref, nrof_harq_processes_v1700, (uint8_t)17u, (uint8_t)32u));
      }
      if (harq_proc_id_offset2_v1700_present) {
        HANDLE_CODE(pack_integer(bref, harq_proc_id_offset2_v1700, (uint8_t)16u, (uint8_t)31u));
      }
      if (cfg_grant_timer_v1700_present) {
        HANDLE_CODE(pack_integer(bref, cfg_grant_timer_v1700, (uint16_t)33u, (uint16_t)288u));
      }
      if (cg_min_dfi_delay_v1710_present) {
        HANDLE_CODE(pack_integer(bref, cg_min_dfi_delay_v1710, (uint16_t)238u, (uint16_t)3584u));
      }
    }
    if (group_flags[2]) {
      varlength_field_pack_guard varlen_scope(bref, false);

      HANDLE_CODE(bref.pack(harq_proc_id_offset_v1730_present, 1));
      HANDLE_CODE(bref.pack(cg_nrof_slots_r17_present, 1));
      if (harq_proc_id_offset_v1730_present) {
        HANDLE_CODE(pack_integer(bref, harq_proc_id_offset_v1730, (uint8_t)16u, (uint8_t)31u));
      }
      if (cg_nrof_slots_r17_present) {
        HANDLE_CODE(pack_integer(bref, cg_nrof_slots_r17, (uint16_t)1u, (uint16_t)320u));
      }
    }
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE cfg_grant_cfg_s::unpack(cbit_ref& bref)
{
  bref.unpack(ext, 1);
  HANDLE_CODE(bref.unpack(freq_hop_present, 1));
  HANDLE_CODE(bref.unpack(mcs_table_present, 1));
  HANDLE_CODE(bref.unpack(mcs_table_transform_precoder_present, 1));
  HANDLE_CODE(bref.unpack(uci_on_pusch_present, 1));
  HANDLE_CODE(bref.unpack(rbg_size_present, 1));
  HANDLE_CODE(bref.unpack(transform_precoder_present, 1));
  HANDLE_CODE(bref.unpack(rep_k_rv_present, 1));
  HANDLE_CODE(bref.unpack(cfg_grant_timer_present, 1));
  HANDLE_CODE(bref.unpack(rrc_cfg_ul_grant_present, 1));

  if (freq_hop_present) {
    HANDLE_CODE(freq_hop.unpack(bref));
  }
  HANDLE_CODE(cg_dmrs_cfg.unpack(bref));
  if (mcs_table_present) {
    HANDLE_CODE(mcs_table.unpack(bref));
  }
  if (mcs_table_transform_precoder_present) {
    HANDLE_CODE(mcs_table_transform_precoder.unpack(bref));
  }
  if (uci_on_pusch_present) {
    HANDLE_CODE(uci_on_pusch.unpack(bref));
  }
  HANDLE_CODE(res_alloc.unpack(bref));
  HANDLE_CODE(pwr_ctrl_loop_to_use.unpack(bref));
  HANDLE_CODE(unpack_integer(p0_pusch_alpha, bref, (uint8_t)0u, (uint8_t)29u));
  if (transform_precoder_present) {
    HANDLE_CODE(transform_precoder.unpack(bref));
  }
  HANDLE_CODE(unpack_integer(nrof_harq_processes, bref, (uint8_t)1u, (uint8_t)16u));
  HANDLE_CODE(rep_k.unpack(bref));
  if (rep_k_rv_present) {
    HANDLE_CODE(rep_k_rv.unpack(bref));
  }
  HANDLE_CODE(periodicity.unpack(bref));
  if (cfg_grant_timer_present) {
    HANDLE_CODE(unpack_integer(cfg_grant_timer, bref, (uint8_t)1u, (uint8_t)64u));
  }
  if (rrc_cfg_ul_grant_present) {
    HANDLE_CODE(rrc_cfg_ul_grant.unpack(bref));
  }

  if (ext) {
    ext_groups_unpacker_guard group_flags(3);
    group_flags.unpack(bref);

    if (group_flags[0]) {
      varlength_field_unpack_guard varlen_scope(bref, false);

      HANDLE_CODE(bref.unpack(cg_retx_timer_r16_present, 1));
      HANDLE_CODE(bref.unpack(cg_min_dfi_delay_r16_present, 1));
      HANDLE_CODE(bref.unpack(cg_nrof_pusch_in_slot_r16_present, 1));
      HANDLE_CODE(bref.unpack(cg_nrof_slots_r16_present, 1));
      unpack_presence_flag(cg_start_offsets_r16, bref);
      HANDLE_CODE(bref.unpack(cg_uci_mux_r16_present, 1));
      HANDLE_CODE(bref.unpack(cg_cot_sharing_offset_r16_present, 1));
      HANDLE_CODE(bref.unpack(beta_offset_cg_uci_r16_present, 1));
      unpack_presence_flag(cg_cot_sharing_list_r16, bref);
      HANDLE_CODE(bref.unpack(harq_proc_id_offset_r16_present, 1));
      HANDLE_CODE(bref.unpack(harq_proc_id_offset2_r16_present, 1));
      HANDLE_CODE(bref.unpack(cfg_grant_cfg_idx_r16_present, 1));
      HANDLE_CODE(bref.unpack(cfg_grant_cfg_idx_mac_r16_present, 1));
      HANDLE_CODE(bref.unpack(periodicity_ext_r16_present, 1));
      HANDLE_CODE(bref.unpack(start_from_rv0_r16_present, 1));
      HANDLE_CODE(bref.unpack(phy_prio_idx_r16_present, 1));
      HANDLE_CODE(bref.unpack(autonomous_tx_r16_present, 1));
      if (cg_retx_timer_r16_present) {
        HANDLE_CODE(unpack_integer(cg_retx_timer_r16, bref, (uint8_t)1u, (uint8_t)64u));
      }
      if (cg_min_dfi_delay_r16_present) {
        HANDLE_CODE(cg_min_dfi_delay_r16.unpack(bref));
      }
      if (cg_nrof_pusch_in_slot_r16_present) {
        HANDLE_CODE(unpack_integer(cg_nrof_pusch_in_slot_r16, bref, (uint8_t)1u, (uint8_t)7u));
      }
      if (cg_nrof_slots_r16_present) {
        HANDLE_CODE(unpack_integer(cg_nrof_slots_r16, bref, (uint8_t)1u, (uint8_t)40u));
      }
      if (cg_start_offsets_r16.is_present()) {
        HANDLE_CODE(cg_start_offsets_r16->unpack(bref));
      }
      if (cg_cot_sharing_offset_r16_present) {
        HANDLE_CODE(unpack_integer(cg_cot_sharing_offset_r16, bref, (uint8_t)1u, (uint8_t)39u));
      }
      if (beta_offset_cg_uci_r16_present) {
        HANDLE_CODE(unpack_integer(beta_offset_cg_uci_r16, bref, (uint8_t)0u, (uint8_t)31u));
      }
      if (cg_cot_sharing_list_r16.is_present()) {
        HANDLE_CODE(unpack_dyn_seq_of(*cg_cot_sharing_list_r16, bref, 1, 1709));
      }
      if (harq_proc_id_offset_r16_present) {
        HANDLE_CODE(unpack_integer(harq_proc_id_offset_r16, bref, (uint8_t)0u, (uint8_t)15u));
      }
      if (harq_proc_id_offset2_r16_present) {
        HANDLE_CODE(unpack_integer(harq_proc_id_offset2_r16, bref, (uint8_t)0u, (uint8_t)15u));
      }
      if (cfg_grant_cfg_idx_r16_present) {
        HANDLE_CODE(unpack_integer(cfg_grant_cfg_idx_r16, bref, (uint8_t)0u, (uint8_t)11u));
      }
      if (cfg_grant_cfg_idx_mac_r16_present) {
        HANDLE_CODE(unpack_integer(cfg_grant_cfg_idx_mac_r16, bref, (uint8_t)0u, (uint8_t)31u));
      }
      if (periodicity_ext_r16_present) {
        HANDLE_CODE(unpack_integer(periodicity_ext_r16, bref, (uint16_t)1u, (uint16_t)5120u));
      }
      if (start_from_rv0_r16_present) {
        HANDLE_CODE(start_from_rv0_r16.unpack(bref));
      }
      if (phy_prio_idx_r16_present) {
        HANDLE_CODE(phy_prio_idx_r16.unpack(bref));
      }
    }
    if (group_flags[1]) {
      varlength_field_unpack_guard varlen_scope(bref, false);

      unpack_presence_flag(cg_beta_offsets_cross_pri0_r17, bref);
      unpack_presence_flag(cg_beta_offsets_cross_pri1_r17, bref);
      HANDLE_CODE(bref.unpack(map_pattern_r17_present, 1));
      HANDLE_CODE(bref.unpack(seq_offset_for_rv_r17_present, 1));
      HANDLE_CODE(bref.unpack(p0_pusch_alpha2_r17_present, 1));
      HANDLE_CODE(bref.unpack(pwr_ctrl_loop_to_use2_r17_present, 1));
      unpack_presence_flag(cg_cot_sharing_list_r17, bref);
      HANDLE_CODE(bref.unpack(periodicity_ext_r17_present, 1));
      HANDLE_CODE(bref.unpack(rep_k_v1710_present, 1));
      HANDLE_CODE(bref.unpack(nrof_harq_processes_v1700_present, 1));
      HANDLE_CODE(bref.unpack(harq_proc_id_offset2_v1700_present, 1));
      HANDLE_CODE(bref.unpack(cfg_grant_timer_v1700_present, 1));
      HANDLE_CODE(bref.unpack(cg_min_dfi_delay_v1710_present, 1));
      if (cg_beta_offsets_cross_pri0_r17.is_present()) {
        HANDLE_CODE(cg_beta_offsets_cross_pri0_r17->unpack(bref));
      }
      if (cg_beta_offsets_cross_pri1_r17.is_present()) {
        HANDLE_CODE(cg_beta_offsets_cross_pri1_r17->unpack(bref));
      }
      if (map_pattern_r17_present) {
        HANDLE_CODE(map_pattern_r17.unpack(bref));
      }
      if (seq_offset_for_rv_r17_present) {
        HANDLE_CODE(unpack_integer(seq_offset_for_rv_r17, bref, (uint8_t)0u, (uint8_t)3u));
      }
      if (p0_pusch_alpha2_r17_present) {
        HANDLE_CODE(unpack_integer(p0_pusch_alpha2_r17, bref, (uint8_t)0u, (uint8_t)29u));
      }
      if (pwr_ctrl_loop_to_use2_r17_present) {
        HANDLE_CODE(pwr_ctrl_loop_to_use2_r17.unpack(bref));
      }
      if (cg_cot_sharing_list_r17.is_present()) {
        HANDLE_CODE(unpack_dyn_seq_of(*cg_cot_sharing_list_r17, bref, 1, 50722));
      }
      if (periodicity_ext_r17_present) {
        HANDLE_CODE(unpack_integer(periodicity_ext_r17, bref, (uint16_t)1u, (uint16_t)40960u));
      }
      if (rep_k_v1710_present) {
        HANDLE_CODE(rep_k_v1710.unpack(bref));
      }
      if (nrof_harq_processes_v1700_present) {
        HANDLE_CODE(unpack_integer(nrof_harq_processes_v1700, bref, (uint8_t)17u, (uint8_t)32u));
      }
      if (harq_proc_id_offset2_v1700_present) {
        HANDLE_CODE(unpack_integer(harq_proc_id_offset2_v1700, bref, (uint8_t)16u, (uint8_t)31u));
      }
      if (cfg_grant_timer_v1700_present) {
        HANDLE_CODE(unpack_integer(cfg_grant_timer_v1700, bref, (uint16_t)33u, (uint16_t)288u));
      }
      if (cg_min_dfi_delay_v1710_present) {
        HANDLE_CODE(unpack_integer(cg_min_dfi_delay_v1710, bref, (uint16_t)238u, (uint16_t)3584u));
      }
    }
    if (group_flags[2]) {
      varlength_field_unpack_guard varlen_scope(bref, false);

      HANDLE_CODE(bref.unpack(harq_proc_id_offset_v1730_present, 1));
      HANDLE_CODE(bref.unpack(cg_nrof_slots_r17_present, 1));
      if (harq_proc_id_offset_v1730_present) {
        HANDLE_CODE(unpack_integer(harq_proc_id_offset_v1730, bref, (uint8_t)16u, (uint8_t)31u));
      }
      if (cg_nrof_slots_r17_present) {
        HANDLE_CODE(unpack_integer(cg_nrof_slots_r17, bref, (uint16_t)1u, (uint16_t)320u));
      }
    }
  }
  return SRSASN_SUCCESS;
}
void cfg_grant_cfg_s::to_json(json_writer& j) const
{
  j.start_obj();
  if (freq_hop_present) {
    j.write_str("frequencyHopping", freq_hop.to_string());
  }
  j.write_fieldname("cg-DMRS-Configuration");
  cg_dmrs_cfg.to_json(j);
  if (mcs_table_present) {
    j.write_str("mcs-Table", mcs_table.to_string());
  }
  if (mcs_table_transform_precoder_present) {
    j.write_str("mcs-TableTransformPrecoder", mcs_table_transform_precoder.to_string());
  }
  if (uci_on_pusch_present) {
    j.write_fieldname("uci-OnPUSCH");
    uci_on_pusch.to_json(j);
  }
  j.write_str("resourceAllocation", res_alloc.to_string());
  if (rbg_size_present) {
    j.write_str("rbg-Size", "config2");
  }
  j.write_str("powerControlLoopToUse", pwr_ctrl_loop_to_use.to_string());
  j.write_int("p0-PUSCH-Alpha", p0_pusch_alpha);
  if (transform_precoder_present) {
    j.write_str("transformPrecoder", transform_precoder.to_string());
  }
  j.write_int("nrofHARQ-Processes", nrof_harq_processes);
  j.write_str("repK", rep_k.to_string());
  if (rep_k_rv_present) {
    j.write_str("repK-RV", rep_k_rv.to_string());
  }
  j.write_str("periodicity", periodicity.to_string());
  if (cfg_grant_timer_present) {
    j.write_int("configuredGrantTimer", cfg_grant_timer);
  }
  if (rrc_cfg_ul_grant_present) {
    j.write_fieldname("rrc-ConfiguredUplinkGrant");
    rrc_cfg_ul_grant.to_json(j);
  }
  if (ext) {
    if (cg_retx_timer_r16_present) {
      j.write_int("cg-RetransmissionTimer-r16", cg_retx_timer_r16);
    }
    if (cg_min_dfi_delay_r16_present) {
      j.write_str("cg-minDFI-Delay-r16", cg_min_dfi_delay_r16.to_string());
    }
    if (cg_nrof_pusch_in_slot_r16_present) {
      j.write_int("cg-nrofPUSCH-InSlot-r16", cg_nrof_pusch_in_slot_r16);
    }
    if (cg_nrof_slots_r16_present) {
      j.write_int("cg-nrofSlots-r16", cg_nrof_slots_r16);
    }
    if (cg_start_offsets_r16.is_present()) {
      j.write_fieldname("cg-StartingOffsets-r16");
      cg_start_offsets_r16->to_json(j);
    }
    if (cg_uci_mux_r16_present) {
      j.write_str("cg-UCI-Multiplexing-r16", "enabled");
    }
    if (cg_cot_sharing_offset_r16_present) {
      j.write_int("cg-COT-SharingOffset-r16", cg_cot_sharing_offset_r16);
    }
    if (beta_offset_cg_uci_r16_present) {
      j.write_int("betaOffsetCG-UCI-r16", beta_offset_cg_uci_r16);
    }
    if (cg_cot_sharing_list_r16.is_present()) {
      j.start_array("cg-COT-SharingList-r16");
      for (const auto& e1 : *cg_cot_sharing_list_r16) {
        e1.to_json(j);
      }
      j.end_array();
    }
    if (harq_proc_id_offset_r16_present) {
      j.write_int("harq-ProcID-Offset-r16", harq_proc_id_offset_r16);
    }
    if (harq_proc_id_offset2_r16_present) {
      j.write_int("harq-ProcID-Offset2-r16", harq_proc_id_offset2_r16);
    }
    if (cfg_grant_cfg_idx_r16_present) {
      j.write_int("configuredGrantConfigIndex-r16", cfg_grant_cfg_idx_r16);
    }
    if (cfg_grant_cfg_idx_mac_r16_present) {
      j.write_int("configuredGrantConfigIndexMAC-r16", cfg_grant_cfg_idx_mac_r16);
    }
    if (periodicity_ext_r16_present) {
      j.write_int("periodicityExt-r16", periodicity_ext_r16);
    }
    if (start_from_rv0_r16_present) {
      j.write_str("startingFromRV0-r16", start_from_rv0_r16.to_string());
    }
    if (phy_prio_idx_r16_present) {
      j.write_str("phy-PriorityIndex-r16", phy_prio_idx_r16.to_string());
    }
    if (autonomous_tx_r16_present) {
      j.write_str("autonomousTx-r16", "enabled");
    }
    if (cg_beta_offsets_cross_pri0_r17.is_present()) {
      j.write_fieldname("cg-betaOffsetsCrossPri0-r17");
      cg_beta_offsets_cross_pri0_r17->to_json(j);
    }
    if (cg_beta_offsets_cross_pri1_r17.is_present()) {
      j.write_fieldname("cg-betaOffsetsCrossPri1-r17");
      cg_beta_offsets_cross_pri1_r17->to_json(j);
    }
    if (map_pattern_r17_present) {
      j.write_str("mappingPattern-r17", map_pattern_r17.to_string());
    }
    if (seq_offset_for_rv_r17_present) {
      j.write_int("sequenceOffsetForRV-r17", seq_offset_for_rv_r17);
    }
    if (p0_pusch_alpha2_r17_present) {
      j.write_int("p0-PUSCH-Alpha2-r17", p0_pusch_alpha2_r17);
    }
    if (pwr_ctrl_loop_to_use2_r17_present) {
      j.write_str("powerControlLoopToUse2-r17", pwr_ctrl_loop_to_use2_r17.to_string());
    }
    if (cg_cot_sharing_list_r17.is_present()) {
      j.start_array("cg-COT-SharingList-r17");
      for (const auto& e1 : *cg_cot_sharing_list_r17) {
        e1.to_json(j);
      }
      j.end_array();
    }
    if (periodicity_ext_r17_present) {
      j.write_int("periodicityExt-r17", periodicity_ext_r17);
    }
    if (rep_k_v1710_present) {
      j.write_str("repK-v1710", rep_k_v1710.to_string());
    }
    if (nrof_harq_processes_v1700_present) {
      j.write_int("nrofHARQ-Processes-v1700", nrof_harq_processes_v1700);
    }
    if (harq_proc_id_offset2_v1700_present) {
      j.write_int("harq-ProcID-Offset2-v1700", harq_proc_id_offset2_v1700);
    }
    if (cfg_grant_timer_v1700_present) {
      j.write_int("configuredGrantTimer-v1700", cfg_grant_timer_v1700);
    }
    if (cg_min_dfi_delay_v1710_present) {
      j.write_int("cg-minDFI-Delay-v1710", cg_min_dfi_delay_v1710);
    }
    if (harq_proc_id_offset_v1730_present) {
      j.write_int("harq-ProcID-Offset-v1730", harq_proc_id_offset_v1730);
    }
    if (cg_nrof_slots_r17_present) {
      j.write_int("cg-nrofSlots-r17", cg_nrof_slots_r17);
    }
  }
  j.end_obj();
}

const char* cfg_grant_cfg_s::freq_hop_opts::to_string() const
{
  static const char* names[] = {"intraSlot", "interSlot"};
  return convert_enum_idx(names, 2, value, "cfg_grant_cfg_s::freq_hop_e_");
}

const char* cfg_grant_cfg_s::mcs_table_opts::to_string() const
{
  static const char* names[] = {"qam256", "qam64LowSE"};
  return convert_enum_idx(names, 2, value, "cfg_grant_cfg_s::mcs_table_e_");
}
uint16_t cfg_grant_cfg_s::mcs_table_opts::to_number() const
{
  static const uint16_t numbers[] = {256, 64};
  return map_enum_number(numbers, 2, value, "cfg_grant_cfg_s::mcs_table_e_");
}

const char* cfg_grant_cfg_s::mcs_table_transform_precoder_opts::to_string() const
{
  static const char* names[] = {"qam256", "qam64LowSE"};
  return convert_enum_idx(names, 2, value, "cfg_grant_cfg_s::mcs_table_transform_precoder_e_");
}
uint16_t cfg_grant_cfg_s::mcs_table_transform_precoder_opts::to_number() const
{
  static const uint16_t numbers[] = {256, 64};
  return map_enum_number(numbers, 2, value, "cfg_grant_cfg_s::mcs_table_transform_precoder_e_");
}

const char* cfg_grant_cfg_s::res_alloc_opts::to_string() const
{
  static const char* names[] = {"resourceAllocationType0", "resourceAllocationType1", "dynamicSwitch"};
  return convert_enum_idx(names, 3, value, "cfg_grant_cfg_s::res_alloc_e_");
}
uint8_t cfg_grant_cfg_s::res_alloc_opts::to_number() const
{
  static const uint8_t numbers[] = {0, 1};
  return map_enum_number(numbers, 2, value, "cfg_grant_cfg_s::res_alloc_e_");
}

const char* cfg_grant_cfg_s::pwr_ctrl_loop_to_use_opts::to_string() const
{
  static const char* names[] = {"n0", "n1"};
  return convert_enum_idx(names, 2, value, "cfg_grant_cfg_s::pwr_ctrl_loop_to_use_e_");
}
uint8_t cfg_grant_cfg_s::pwr_ctrl_loop_to_use_opts::to_number() const
{
  static const uint8_t numbers[] = {0, 1};
  return map_enum_number(numbers, 2, value, "cfg_grant_cfg_s::pwr_ctrl_loop_to_use_e_");
}

const char* cfg_grant_cfg_s::transform_precoder_opts::to_string() const
{
  static const char* names[] = {"enabled", "disabled"};
  return convert_enum_idx(names, 2, value, "cfg_grant_cfg_s::transform_precoder_e_");
}

const char* cfg_grant_cfg_s::rep_k_opts::to_string() const
{
  static const char* names[] = {"n1", "n2", "n4", "n8"};
  return convert_enum_idx(names, 4, value, "cfg_grant_cfg_s::rep_k_e_");
}
uint8_t cfg_grant_cfg_s::rep_k_opts::to_number() const
{
  static const uint8_t numbers[] = {1, 2, 4, 8};
  return map_enum_number(numbers, 4, value, "cfg_grant_cfg_s::rep_k_e_");
}

const char* cfg_grant_cfg_s::rep_k_rv_opts::to_string() const
{
  static const char* names[] = {"s1-0231", "s2-0303", "s3-0000"};
  return convert_enum_idx(names, 3, value, "cfg_grant_cfg_s::rep_k_rv_e_");
}
uint8_t cfg_grant_cfg_s::rep_k_rv_opts::to_number() const
{
  static const uint8_t numbers[] = {1, 2, 3};
  return map_enum_number(numbers, 3, value, "cfg_grant_cfg_s::rep_k_rv_e_");
}

const char* cfg_grant_cfg_s::periodicity_opts::to_string() const
{
  static const char* names[] = {
      "sym2",      "sym7",      "sym1x14",   "sym2x14",    "sym4x14",    "sym5x14",    "sym8x14",    "sym10x14",
      "sym16x14",  "sym20x14",  "sym32x14",  "sym40x14",   "sym64x14",   "sym80x14",   "sym128x14",  "sym160x14",
      "sym256x14", "sym320x14", "sym512x14", "sym640x14",  "sym1024x14", "sym1280x14", "sym2560x14", "sym5120x14",
      "sym6",      "sym1x12",   "sym2x12",   "sym4x12",    "sym5x12",    "sym8x12",    "sym10x12",   "sym16x12",
      "sym20x12",  "sym32x12",  "sym40x12",  "sym64x12",   "sym80x12",   "sym128x12",  "sym160x12",  "sym256x12",
      "sym320x12", "sym512x12", "sym640x12", "sym1280x12", "sym2560x12"};
  return convert_enum_idx(names, 45, value, "cfg_grant_cfg_s::periodicity_e_");
}

SRSASN_CODE cfg_grant_cfg_s::rrc_cfg_ul_grant_s_::pack(bit_ref& bref) const
{
  bref.pack(ext, 1);
  HANDLE_CODE(bref.pack(dmrs_seq_initization_present, 1));
  HANDLE_CODE(bref.pack(srs_res_ind_present, 1));
  HANDLE_CODE(bref.pack(freq_hop_offset_present, 1));

  HANDLE_CODE(pack_integer(bref, time_domain_offset, (uint16_t)0u, (uint16_t)5119u));
  HANDLE_CODE(pack_integer(bref, time_domain_alloc, (uint8_t)0u, (uint8_t)15u));
  HANDLE_CODE(freq_domain_alloc.pack(bref));
  HANDLE_CODE(pack_integer(bref, ant_port, (uint8_t)0u, (uint8_t)31u));
  if (dmrs_seq_initization_present) {
    HANDLE_CODE(pack_integer(bref, dmrs_seq_initization, (uint8_t)0u, (uint8_t)1u));
  }
  HANDLE_CODE(pack_integer(bref, precoding_and_nof_layers, (uint8_t)0u, (uint8_t)63u));
  if (srs_res_ind_present) {
    HANDLE_CODE(pack_integer(bref, srs_res_ind, (uint8_t)0u, (uint8_t)15u));
  }
  HANDLE_CODE(pack_integer(bref, mcs_and_tbs, (uint8_t)0u, (uint8_t)31u));
  if (freq_hop_offset_present) {
    HANDLE_CODE(pack_integer(bref, freq_hop_offset, (uint16_t)1u, (uint16_t)274u));
  }
  HANDLE_CODE(pack_integer(bref, pathloss_ref_idx, (uint8_t)0u, (uint8_t)3u));

  if (ext) {
    ext_groups_packer_guard group_flags;
    group_flags[0] |= pusch_rep_type_ind_r16_present;
    group_flags[0] |= freq_hop_pusch_rep_type_b_r16_present;
    group_flags[0] |= time_ref_sfn_r16_present;
    group_flags[1] |= pathloss_ref_idx2_r17_present;
    group_flags[1] |= srs_res_ind2_r17_present;
    group_flags[1] |= precoding_and_nof_layers2_r17_present;
    group_flags[1] |= time_domain_alloc_v1710_present;
    group_flags[1] |= time_domain_offset_r17_present;
    group_flags[1] |= cg_sdt_cfg_r17.is_present();
    group_flags.pack(bref);

    if (group_flags[0]) {
      varlength_field_pack_guard varlen_scope(bref, false);

      HANDLE_CODE(bref.pack(pusch_rep_type_ind_r16_present, 1));
      HANDLE_CODE(bref.pack(freq_hop_pusch_rep_type_b_r16_present, 1));
      HANDLE_CODE(bref.pack(time_ref_sfn_r16_present, 1));
      if (pusch_rep_type_ind_r16_present) {
        HANDLE_CODE(pusch_rep_type_ind_r16.pack(bref));
      }
      if (freq_hop_pusch_rep_type_b_r16_present) {
        HANDLE_CODE(freq_hop_pusch_rep_type_b_r16.pack(bref));
      }
    }
    if (group_flags[1]) {
      varlength_field_pack_guard varlen_scope(bref, false);

      HANDLE_CODE(bref.pack(pathloss_ref_idx2_r17_present, 1));
      HANDLE_CODE(bref.pack(srs_res_ind2_r17_present, 1));
      HANDLE_CODE(bref.pack(precoding_and_nof_layers2_r17_present, 1));
      HANDLE_CODE(bref.pack(time_domain_alloc_v1710_present, 1));
      HANDLE_CODE(bref.pack(time_domain_offset_r17_present, 1));
      HANDLE_CODE(bref.pack(cg_sdt_cfg_r17.is_present(), 1));
      if (pathloss_ref_idx2_r17_present) {
        HANDLE_CODE(pack_integer(bref, pathloss_ref_idx2_r17, (uint8_t)0u, (uint8_t)3u));
      }
      if (srs_res_ind2_r17_present) {
        HANDLE_CODE(pack_integer(bref, srs_res_ind2_r17, (uint8_t)0u, (uint8_t)15u));
      }
      if (precoding_and_nof_layers2_r17_present) {
        HANDLE_CODE(pack_integer(bref, precoding_and_nof_layers2_r17, (uint8_t)0u, (uint8_t)63u));
      }
      if (time_domain_alloc_v1710_present) {
        HANDLE_CODE(pack_integer(bref, time_domain_alloc_v1710, (uint8_t)16u, (uint8_t)63u));
      }
      if (time_domain_offset_r17_present) {
        HANDLE_CODE(pack_integer(bref, time_domain_offset_r17, (uint16_t)0u, (uint16_t)40959u));
      }
      if (cg_sdt_cfg_r17.is_present()) {
        HANDLE_CODE(cg_sdt_cfg_r17->pack(bref));
      }
    }
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE cfg_grant_cfg_s::rrc_cfg_ul_grant_s_::unpack(cbit_ref& bref)
{
  bref.unpack(ext, 1);
  HANDLE_CODE(bref.unpack(dmrs_seq_initization_present, 1));
  HANDLE_CODE(bref.unpack(srs_res_ind_present, 1));
  HANDLE_CODE(bref.unpack(freq_hop_offset_present, 1));

  HANDLE_CODE(unpack_integer(time_domain_offset, bref, (uint16_t)0u, (uint16_t)5119u));
  HANDLE_CODE(unpack_integer(time_domain_alloc, bref, (uint8_t)0u, (uint8_t)15u));
  HANDLE_CODE(freq_domain_alloc.unpack(bref));
  HANDLE_CODE(unpack_integer(ant_port, bref, (uint8_t)0u, (uint8_t)31u));
  if (dmrs_seq_initization_present) {
    HANDLE_CODE(unpack_integer(dmrs_seq_initization, bref, (uint8_t)0u, (uint8_t)1u));
  }
  HANDLE_CODE(unpack_integer(precoding_and_nof_layers, bref, (uint8_t)0u, (uint8_t)63u));
  if (srs_res_ind_present) {
    HANDLE_CODE(unpack_integer(srs_res_ind, bref, (uint8_t)0u, (uint8_t)15u));
  }
  HANDLE_CODE(unpack_integer(mcs_and_tbs, bref, (uint8_t)0u, (uint8_t)31u));
  if (freq_hop_offset_present) {
    HANDLE_CODE(unpack_integer(freq_hop_offset, bref, (uint16_t)1u, (uint16_t)274u));
  }
  HANDLE_CODE(unpack_integer(pathloss_ref_idx, bref, (uint8_t)0u, (uint8_t)3u));

  if (ext) {
    ext_groups_unpacker_guard group_flags(2);
    group_flags.unpack(bref);

    if (group_flags[0]) {
      varlength_field_unpack_guard varlen_scope(bref, false);

      HANDLE_CODE(bref.unpack(pusch_rep_type_ind_r16_present, 1));
      HANDLE_CODE(bref.unpack(freq_hop_pusch_rep_type_b_r16_present, 1));
      HANDLE_CODE(bref.unpack(time_ref_sfn_r16_present, 1));
      if (pusch_rep_type_ind_r16_present) {
        HANDLE_CODE(pusch_rep_type_ind_r16.unpack(bref));
      }
      if (freq_hop_pusch_rep_type_b_r16_present) {
        HANDLE_CODE(freq_hop_pusch_rep_type_b_r16.unpack(bref));
      }
    }
    if (group_flags[1]) {
      varlength_field_unpack_guard varlen_scope(bref, false);

      HANDLE_CODE(bref.unpack(pathloss_ref_idx2_r17_present, 1));
      HANDLE_CODE(bref.unpack(srs_res_ind2_r17_present, 1));
      HANDLE_CODE(bref.unpack(precoding_and_nof_layers2_r17_present, 1));
      HANDLE_CODE(bref.unpack(time_domain_alloc_v1710_present, 1));
      HANDLE_CODE(bref.unpack(time_domain_offset_r17_present, 1));
      unpack_presence_flag(cg_sdt_cfg_r17, bref);
      if (pathloss_ref_idx2_r17_present) {
        HANDLE_CODE(unpack_integer(pathloss_ref_idx2_r17, bref, (uint8_t)0u, (uint8_t)3u));
      }
      if (srs_res_ind2_r17_present) {
        HANDLE_CODE(unpack_integer(srs_res_ind2_r17, bref, (uint8_t)0u, (uint8_t)15u));
      }
      if (precoding_and_nof_layers2_r17_present) {
        HANDLE_CODE(unpack_integer(precoding_and_nof_layers2_r17, bref, (uint8_t)0u, (uint8_t)63u));
      }
      if (time_domain_alloc_v1710_present) {
        HANDLE_CODE(unpack_integer(time_domain_alloc_v1710, bref, (uint8_t)16u, (uint8_t)63u));
      }
      if (time_domain_offset_r17_present) {
        HANDLE_CODE(unpack_integer(time_domain_offset_r17, bref, (uint16_t)0u, (uint16_t)40959u));
      }
      if (cg_sdt_cfg_r17.is_present()) {
        HANDLE_CODE(cg_sdt_cfg_r17->unpack(bref));
      }
    }
  }
  return SRSASN_SUCCESS;
}
void cfg_grant_cfg_s::rrc_cfg_ul_grant_s_::to_json(json_writer& j) const
{
  j.start_obj();
  j.write_int("timeDomainOffset", time_domain_offset);
  j.write_int("timeDomainAllocation", time_domain_alloc);
  j.write_str("frequencyDomainAllocation", freq_domain_alloc.to_string());
  j.write_int("antennaPort", ant_port);
  if (dmrs_seq_initization_present) {
    j.write_int("dmrs-SeqInitialization", dmrs_seq_initization);
  }
  j.write_int("precodingAndNumberOfLayers", precoding_and_nof_layers);
  if (srs_res_ind_present) {
    j.write_int("srs-ResourceIndicator", srs_res_ind);
  }
  j.write_int("mcsAndTBS", mcs_and_tbs);
  if (freq_hop_offset_present) {
    j.write_int("frequencyHoppingOffset", freq_hop_offset);
  }
  j.write_int("pathlossReferenceIndex", pathloss_ref_idx);
  if (ext) {
    if (pusch_rep_type_ind_r16_present) {
      j.write_str("pusch-RepTypeIndicator-r16", pusch_rep_type_ind_r16.to_string());
    }
    if (freq_hop_pusch_rep_type_b_r16_present) {
      j.write_str("frequencyHoppingPUSCH-RepTypeB-r16", freq_hop_pusch_rep_type_b_r16.to_string());
    }
    if (time_ref_sfn_r16_present) {
      j.write_str("timeReferenceSFN-r16", "sfn512");
    }
    if (pathloss_ref_idx2_r17_present) {
      j.write_int("pathlossReferenceIndex2-r17", pathloss_ref_idx2_r17);
    }
    if (srs_res_ind2_r17_present) {
      j.write_int("srs-ResourceIndicator2-r17", srs_res_ind2_r17);
    }
    if (precoding_and_nof_layers2_r17_present) {
      j.write_int("precodingAndNumberOfLayers2-r17", precoding_and_nof_layers2_r17);
    }
    if (time_domain_alloc_v1710_present) {
      j.write_int("timeDomainAllocation-v1710", time_domain_alloc_v1710);
    }
    if (time_domain_offset_r17_present) {
      j.write_int("timeDomainOffset-r17", time_domain_offset_r17);
    }
    if (cg_sdt_cfg_r17.is_present()) {
      j.write_fieldname("cg-SDT-Configuration-r17");
      cg_sdt_cfg_r17->to_json(j);
    }
  }
  j.end_obj();
}

const char* cfg_grant_cfg_s::rrc_cfg_ul_grant_s_::pusch_rep_type_ind_r16_opts::to_string() const
{
  static const char* names[] = {"pusch-RepTypeA", "pusch-RepTypeB"};
  return convert_enum_idx(names, 2, value, "cfg_grant_cfg_s::rrc_cfg_ul_grant_s_::pusch_rep_type_ind_r16_e_");
}

const char* cfg_grant_cfg_s::rrc_cfg_ul_grant_s_::freq_hop_pusch_rep_type_b_r16_opts::to_string() const
{
  static const char* names[] = {"interRepetition", "interSlot"};
  return convert_enum_idx(names, 2, value, "cfg_grant_cfg_s::rrc_cfg_ul_grant_s_::freq_hop_pusch_rep_type_b_r16_e_");
}

const char* cfg_grant_cfg_s::cg_min_dfi_delay_r16_opts::to_string() const
{
  static const char* names[] = {"sym7",
                                "sym1x14",
                                "sym2x14",
                                "sym3x14",
                                "sym4x14",
                                "sym5x14",
                                "sym6x14",
                                "sym7x14",
                                "sym8x14",
                                "sym9x14",
                                "sym10x14",
                                "sym11x14",
                                "sym12x14",
                                "sym13x14",
                                "sym14x14",
                                "sym15x14",
                                "sym16x14"};
  return convert_enum_idx(names, 17, value, "cfg_grant_cfg_s::cg_min_dfi_delay_r16_e_");
}

const char* cfg_grant_cfg_s::start_from_rv0_r16_opts::to_string() const
{
  static const char* names[] = {"on", "off"};
  return convert_enum_idx(names, 2, value, "cfg_grant_cfg_s::start_from_rv0_r16_e_");
}

const char* cfg_grant_cfg_s::phy_prio_idx_r16_opts::to_string() const
{
  static const char* names[] = {"p0", "p1"};
  return convert_enum_idx(names, 2, value, "cfg_grant_cfg_s::phy_prio_idx_r16_e_");
}
uint8_t cfg_grant_cfg_s::phy_prio_idx_r16_opts::to_number() const
{
  static const uint8_t numbers[] = {0, 1};
  return map_enum_number(numbers, 2, value, "cfg_grant_cfg_s::phy_prio_idx_r16_e_");
}

const char* cfg_grant_cfg_s::map_pattern_r17_opts::to_string() const
{
  static const char* names[] = {"cyclicMapping", "sequentialMapping"};
  return convert_enum_idx(names, 2, value, "cfg_grant_cfg_s::map_pattern_r17_e_");
}

const char* cfg_grant_cfg_s::pwr_ctrl_loop_to_use2_r17_opts::to_string() const
{
  static const char* names[] = {"n0", "n1"};
  return convert_enum_idx(names, 2, value, "cfg_grant_cfg_s::pwr_ctrl_loop_to_use2_r17_e_");
}
uint8_t cfg_grant_cfg_s::pwr_ctrl_loop_to_use2_r17_opts::to_number() const
{
  static const uint8_t numbers[] = {0, 1};
  return map_enum_number(numbers, 2, value, "cfg_grant_cfg_s::pwr_ctrl_loop_to_use2_r17_e_");
}

const char* cfg_grant_cfg_s::rep_k_v1710_opts::to_string() const
{
  static const char* names[] = {"n12", "n16", "n24", "n32"};
  return convert_enum_idx(names, 4, value, "cfg_grant_cfg_s::rep_k_v1710_e_");
}
uint8_t cfg_grant_cfg_s::rep_k_v1710_opts::to_number() const
{
  static const uint8_t numbers[] = {12, 16, 24, 32};
  return map_enum_number(numbers, 4, value, "cfg_grant_cfg_s::rep_k_v1710_e_");
}

// DMRS-BundlingPUSCH-Config-r17 ::= SEQUENCE
SRSASN_CODE dmrs_bundling_pusch_cfg_r17_s::pack(bit_ref& bref) const
{
  bref.pack(ext, 1);
  HANDLE_CODE(bref.pack(pusch_dmrs_bundling_r17_present, 1));
  HANDLE_CODE(bref.pack(pusch_time_domain_win_len_r17_present, 1));
  HANDLE_CODE(bref.pack(pusch_win_restart_r17_present, 1));
  HANDLE_CODE(bref.pack(pusch_freq_hop_interv_r17_present, 1));

  if (pusch_time_domain_win_len_r17_present) {
    HANDLE_CODE(pack_integer(bref, pusch_time_domain_win_len_r17, (uint8_t)2u, (uint8_t)32u));
  }
  if (pusch_freq_hop_interv_r17_present) {
    HANDLE_CODE(pusch_freq_hop_interv_r17.pack(bref));
  }

  return SRSASN_SUCCESS;
}
SRSASN_CODE dmrs_bundling_pusch_cfg_r17_s::unpack(cbit_ref& bref)
{
  bref.unpack(ext, 1);
  HANDLE_CODE(bref.unpack(pusch_dmrs_bundling_r17_present, 1));
  HANDLE_CODE(bref.unpack(pusch_time_domain_win_len_r17_present, 1));
  HANDLE_CODE(bref.unpack(pusch_win_restart_r17_present, 1));
  HANDLE_CODE(bref.unpack(pusch_freq_hop_interv_r17_present, 1));

  if (pusch_time_domain_win_len_r17_present) {
    HANDLE_CODE(unpack_integer(pusch_time_domain_win_len_r17, bref, (uint8_t)2u, (uint8_t)32u));
  }
  if (pusch_freq_hop_interv_r17_present) {
    HANDLE_CODE(pusch_freq_hop_interv_r17.unpack(bref));
  }

  return SRSASN_SUCCESS;
}
void dmrs_bundling_pusch_cfg_r17_s::to_json(json_writer& j) const
{
  j.start_obj();
  if (pusch_dmrs_bundling_r17_present) {
    j.write_str("pusch-DMRS-Bundling-r17", "enabled");
  }
  if (pusch_time_domain_win_len_r17_present) {
    j.write_int("pusch-TimeDomainWindowLength-r17", pusch_time_domain_win_len_r17);
  }
  if (pusch_win_restart_r17_present) {
    j.write_str("pusch-WindowRestart-r17", "enabled");
  }
  if (pusch_freq_hop_interv_r17_present) {
    j.write_str("pusch-FrequencyHoppingInterval-r17", pusch_freq_hop_interv_r17.to_string());
  }
  j.end_obj();
}

const char* dmrs_bundling_pusch_cfg_r17_s::pusch_freq_hop_interv_r17_opts::to_string() const
{
  static const char* names[] = {"s2", "s4", "s5", "s6", "s8", "s10", "s12", "s14", "s16", "s20"};
  return convert_enum_idx(names, 10, value, "dmrs_bundling_pusch_cfg_r17_s::pusch_freq_hop_interv_r17_e_");
}
uint8_t dmrs_bundling_pusch_cfg_r17_s::pusch_freq_hop_interv_r17_opts::to_number() const
{
  static const uint8_t numbers[] = {2, 4, 5, 6, 8, 10, 12, 14, 16, 20};
  return map_enum_number(numbers, 10, value, "dmrs_bundling_pusch_cfg_r17_s::pusch_freq_hop_interv_r17_e_");
}

// InvalidSymbolPattern-r16 ::= SEQUENCE
SRSASN_CODE invalid_symbol_pattern_r16_s::pack(bit_ref& bref) const
{
  bref.pack(ext, 1);
  HANDLE_CODE(bref.pack(periodicity_and_pattern_r16_present, 1));

  HANDLE_CODE(symbols_r16.pack(bref));
  if (periodicity_and_pattern_r16_present) {
    HANDLE_CODE(periodicity_and_pattern_r16.pack(bref));
  }

  return SRSASN_SUCCESS;
}
SRSASN_CODE invalid_symbol_pattern_r16_s::unpack(cbit_ref& bref)
{
  bref.unpack(ext, 1);
  HANDLE_CODE(bref.unpack(periodicity_and_pattern_r16_present, 1));

  HANDLE_CODE(symbols_r16.unpack(bref));
  if (periodicity_and_pattern_r16_present) {
    HANDLE_CODE(periodicity_and_pattern_r16.unpack(bref));
  }

  return SRSASN_SUCCESS;
}
void invalid_symbol_pattern_r16_s::to_json(json_writer& j) const
{
  j.start_obj();
  j.write_fieldname("symbols-r16");
  symbols_r16.to_json(j);
  if (periodicity_and_pattern_r16_present) {
    j.write_fieldname("periodicityAndPattern-r16");
    periodicity_and_pattern_r16.to_json(j);
  }
  j.end_obj();
}

void invalid_symbol_pattern_r16_s::symbols_r16_c_::destroy_()
{
  switch (type_) {
    case types::one_slot:
      c.destroy<fixed_bitstring<14>>();
      break;
    case types::two_slots:
      c.destroy<fixed_bitstring<28>>();
      break;
    default:
      break;
  }
}
void invalid_symbol_pattern_r16_s::symbols_r16_c_::set(types::options e)
{
  destroy_();
  type_ = e;
  switch (type_) {
    case types::one_slot:
      c.init<fixed_bitstring<14>>();
      break;
    case types::two_slots:
      c.init<fixed_bitstring<28>>();
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "invalid_symbol_pattern_r16_s::symbols_r16_c_");
  }
}
invalid_symbol_pattern_r16_s::symbols_r16_c_::symbols_r16_c_(const invalid_symbol_pattern_r16_s::symbols_r16_c_& other)
{
  type_ = other.type();
  switch (type_) {
    case types::one_slot:
      c.init(other.c.get<fixed_bitstring<14>>());
      break;
    case types::two_slots:
      c.init(other.c.get<fixed_bitstring<28>>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "invalid_symbol_pattern_r16_s::symbols_r16_c_");
  }
}
invalid_symbol_pattern_r16_s::symbols_r16_c_&
invalid_symbol_pattern_r16_s::symbols_r16_c_::operator=(const invalid_symbol_pattern_r16_s::symbols_r16_c_& other)
{
  if (this == &other) {
    return *this;
  }
  set(other.type());
  switch (type_) {
    case types::one_slot:
      c.set(other.c.get<fixed_bitstring<14>>());
      break;
    case types::two_slots:
      c.set(other.c.get<fixed_bitstring<28>>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "invalid_symbol_pattern_r16_s::symbols_r16_c_");
  }

  return *this;
}
fixed_bitstring<14>& invalid_symbol_pattern_r16_s::symbols_r16_c_::set_one_slot()
{
  set(types::one_slot);
  return c.get<fixed_bitstring<14>>();
}
fixed_bitstring<28>& invalid_symbol_pattern_r16_s::symbols_r16_c_::set_two_slots()
{
  set(types::two_slots);
  return c.get<fixed_bitstring<28>>();
}
void invalid_symbol_pattern_r16_s::symbols_r16_c_::to_json(json_writer& j) const
{
  j.start_obj();
  switch (type_) {
    case types::one_slot:
      j.write_str("oneSlot", c.get<fixed_bitstring<14>>().to_string());
      break;
    case types::two_slots:
      j.write_str("twoSlots", c.get<fixed_bitstring<28>>().to_string());
      break;
    default:
      log_invalid_choice_id(type_, "invalid_symbol_pattern_r16_s::symbols_r16_c_");
  }
  j.end_obj();
}
SRSASN_CODE invalid_symbol_pattern_r16_s::symbols_r16_c_::pack(bit_ref& bref) const
{
  type_.pack(bref);
  switch (type_) {
    case types::one_slot:
      HANDLE_CODE(c.get<fixed_bitstring<14>>().pack(bref));
      break;
    case types::two_slots:
      HANDLE_CODE(c.get<fixed_bitstring<28>>().pack(bref));
      break;
    default:
      log_invalid_choice_id(type_, "invalid_symbol_pattern_r16_s::symbols_r16_c_");
      return SRSASN_ERROR_ENCODE_FAIL;
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE invalid_symbol_pattern_r16_s::symbols_r16_c_::unpack(cbit_ref& bref)
{
  types e;
  e.unpack(bref);
  set(e);
  switch (type_) {
    case types::one_slot:
      HANDLE_CODE(c.get<fixed_bitstring<14>>().unpack(bref));
      break;
    case types::two_slots:
      HANDLE_CODE(c.get<fixed_bitstring<28>>().unpack(bref));
      break;
    default:
      log_invalid_choice_id(type_, "invalid_symbol_pattern_r16_s::symbols_r16_c_");
      return SRSASN_ERROR_DECODE_FAIL;
  }
  return SRSASN_SUCCESS;
}

const char* invalid_symbol_pattern_r16_s::symbols_r16_c_::types_opts::to_string() const
{
  static const char* names[] = {"oneSlot", "twoSlots"};
  return convert_enum_idx(names, 2, value, "invalid_symbol_pattern_r16_s::symbols_r16_c_::types");
}
uint8_t invalid_symbol_pattern_r16_s::symbols_r16_c_::types_opts::to_number() const
{
  static const uint8_t numbers[] = {1, 2};
  return map_enum_number(numbers, 2, value, "invalid_symbol_pattern_r16_s::symbols_r16_c_::types");
}

void invalid_symbol_pattern_r16_s::periodicity_and_pattern_r16_c_::destroy_()
{
  switch (type_) {
    case types::n2:
      c.destroy<fixed_bitstring<2>>();
      break;
    case types::n4:
      c.destroy<fixed_bitstring<4>>();
      break;
    case types::n5:
      c.destroy<fixed_bitstring<5>>();
      break;
    case types::n8:
      c.destroy<fixed_bitstring<8>>();
      break;
    case types::n10:
      c.destroy<fixed_bitstring<10>>();
      break;
    case types::n20:
      c.destroy<fixed_bitstring<20>>();
      break;
    case types::n40:
      c.destroy<fixed_bitstring<40>>();
      break;
    default:
      break;
  }
}
void invalid_symbol_pattern_r16_s::periodicity_and_pattern_r16_c_::set(types::options e)
{
  destroy_();
  type_ = e;
  switch (type_) {
    case types::n2:
      c.init<fixed_bitstring<2>>();
      break;
    case types::n4:
      c.init<fixed_bitstring<4>>();
      break;
    case types::n5:
      c.init<fixed_bitstring<5>>();
      break;
    case types::n8:
      c.init<fixed_bitstring<8>>();
      break;
    case types::n10:
      c.init<fixed_bitstring<10>>();
      break;
    case types::n20:
      c.init<fixed_bitstring<20>>();
      break;
    case types::n40:
      c.init<fixed_bitstring<40>>();
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "invalid_symbol_pattern_r16_s::periodicity_and_pattern_r16_c_");
  }
}
invalid_symbol_pattern_r16_s::periodicity_and_pattern_r16_c_::periodicity_and_pattern_r16_c_(
    const invalid_symbol_pattern_r16_s::periodicity_and_pattern_r16_c_& other)
{
  type_ = other.type();
  switch (type_) {
    case types::n2:
      c.init(other.c.get<fixed_bitstring<2>>());
      break;
    case types::n4:
      c.init(other.c.get<fixed_bitstring<4>>());
      break;
    case types::n5:
      c.init(other.c.get<fixed_bitstring<5>>());
      break;
    case types::n8:
      c.init(other.c.get<fixed_bitstring<8>>());
      break;
    case types::n10:
      c.init(other.c.get<fixed_bitstring<10>>());
      break;
    case types::n20:
      c.init(other.c.get<fixed_bitstring<20>>());
      break;
    case types::n40:
      c.init(other.c.get<fixed_bitstring<40>>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "invalid_symbol_pattern_r16_s::periodicity_and_pattern_r16_c_");
  }
}
invalid_symbol_pattern_r16_s::periodicity_and_pattern_r16_c_&
invalid_symbol_pattern_r16_s::periodicity_and_pattern_r16_c_::operator=(
    const invalid_symbol_pattern_r16_s::periodicity_and_pattern_r16_c_& other)
{
  if (this == &other) {
    return *this;
  }
  set(other.type());
  switch (type_) {
    case types::n2:
      c.set(other.c.get<fixed_bitstring<2>>());
      break;
    case types::n4:
      c.set(other.c.get<fixed_bitstring<4>>());
      break;
    case types::n5:
      c.set(other.c.get<fixed_bitstring<5>>());
      break;
    case types::n8:
      c.set(other.c.get<fixed_bitstring<8>>());
      break;
    case types::n10:
      c.set(other.c.get<fixed_bitstring<10>>());
      break;
    case types::n20:
      c.set(other.c.get<fixed_bitstring<20>>());
      break;
    case types::n40:
      c.set(other.c.get<fixed_bitstring<40>>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "invalid_symbol_pattern_r16_s::periodicity_and_pattern_r16_c_");
  }

  return *this;
}
fixed_bitstring<2>& invalid_symbol_pattern_r16_s::periodicity_and_pattern_r16_c_::set_n2()
{
  set(types::n2);
  return c.get<fixed_bitstring<2>>();
}
fixed_bitstring<4>& invalid_symbol_pattern_r16_s::periodicity_and_pattern_r16_c_::set_n4()
{
  set(types::n4);
  return c.get<fixed_bitstring<4>>();
}
fixed_bitstring<5>& invalid_symbol_pattern_r16_s::periodicity_and_pattern_r16_c_::set_n5()
{
  set(types::n5);
  return c.get<fixed_bitstring<5>>();
}
fixed_bitstring<8>& invalid_symbol_pattern_r16_s::periodicity_and_pattern_r16_c_::set_n8()
{
  set(types::n8);
  return c.get<fixed_bitstring<8>>();
}
fixed_bitstring<10>& invalid_symbol_pattern_r16_s::periodicity_and_pattern_r16_c_::set_n10()
{
  set(types::n10);
  return c.get<fixed_bitstring<10>>();
}
fixed_bitstring<20>& invalid_symbol_pattern_r16_s::periodicity_and_pattern_r16_c_::set_n20()
{
  set(types::n20);
  return c.get<fixed_bitstring<20>>();
}
fixed_bitstring<40>& invalid_symbol_pattern_r16_s::periodicity_and_pattern_r16_c_::set_n40()
{
  set(types::n40);
  return c.get<fixed_bitstring<40>>();
}
void invalid_symbol_pattern_r16_s::periodicity_and_pattern_r16_c_::to_json(json_writer& j) const
{
  j.start_obj();
  switch (type_) {
    case types::n2:
      j.write_str("n2", c.get<fixed_bitstring<2>>().to_string());
      break;
    case types::n4:
      j.write_str("n4", c.get<fixed_bitstring<4>>().to_string());
      break;
    case types::n5:
      j.write_str("n5", c.get<fixed_bitstring<5>>().to_string());
      break;
    case types::n8:
      j.write_str("n8", c.get<fixed_bitstring<8>>().to_string());
      break;
    case types::n10:
      j.write_str("n10", c.get<fixed_bitstring<10>>().to_string());
      break;
    case types::n20:
      j.write_str("n20", c.get<fixed_bitstring<20>>().to_string());
      break;
    case types::n40:
      j.write_str("n40", c.get<fixed_bitstring<40>>().to_string());
      break;
    default:
      log_invalid_choice_id(type_, "invalid_symbol_pattern_r16_s::periodicity_and_pattern_r16_c_");
  }
  j.end_obj();
}
SRSASN_CODE invalid_symbol_pattern_r16_s::periodicity_and_pattern_r16_c_::pack(bit_ref& bref) const
{
  type_.pack(bref);
  switch (type_) {
    case types::n2:
      HANDLE_CODE(c.get<fixed_bitstring<2>>().pack(bref));
      break;
    case types::n4:
      HANDLE_CODE(c.get<fixed_bitstring<4>>().pack(bref));
      break;
    case types::n5:
      HANDLE_CODE(c.get<fixed_bitstring<5>>().pack(bref));
      break;
    case types::n8:
      HANDLE_CODE(c.get<fixed_bitstring<8>>().pack(bref));
      break;
    case types::n10:
      HANDLE_CODE(c.get<fixed_bitstring<10>>().pack(bref));
      break;
    case types::n20:
      HANDLE_CODE(c.get<fixed_bitstring<20>>().pack(bref));
      break;
    case types::n40:
      HANDLE_CODE(c.get<fixed_bitstring<40>>().pack(bref));
      break;
    default:
      log_invalid_choice_id(type_, "invalid_symbol_pattern_r16_s::periodicity_and_pattern_r16_c_");
      return SRSASN_ERROR_ENCODE_FAIL;
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE invalid_symbol_pattern_r16_s::periodicity_and_pattern_r16_c_::unpack(cbit_ref& bref)
{
  types e;
  e.unpack(bref);
  set(e);
  switch (type_) {
    case types::n2:
      HANDLE_CODE(c.get<fixed_bitstring<2>>().unpack(bref));
      break;
    case types::n4:
      HANDLE_CODE(c.get<fixed_bitstring<4>>().unpack(bref));
      break;
    case types::n5:
      HANDLE_CODE(c.get<fixed_bitstring<5>>().unpack(bref));
      break;
    case types::n8:
      HANDLE_CODE(c.get<fixed_bitstring<8>>().unpack(bref));
      break;
    case types::n10:
      HANDLE_CODE(c.get<fixed_bitstring<10>>().unpack(bref));
      break;
    case types::n20:
      HANDLE_CODE(c.get<fixed_bitstring<20>>().unpack(bref));
      break;
    case types::n40:
      HANDLE_CODE(c.get<fixed_bitstring<40>>().unpack(bref));
      break;
    default:
      log_invalid_choice_id(type_, "invalid_symbol_pattern_r16_s::periodicity_and_pattern_r16_c_");
      return SRSASN_ERROR_DECODE_FAIL;
  }
  return SRSASN_SUCCESS;
}

const char* invalid_symbol_pattern_r16_s::periodicity_and_pattern_r16_c_::types_opts::to_string() const
{
  static const char* names[] = {"n2", "n4", "n5", "n8", "n10", "n20", "n40"};
  return convert_enum_idx(names, 7, value, "invalid_symbol_pattern_r16_s::periodicity_and_pattern_r16_c_::types");
}
uint8_t invalid_symbol_pattern_r16_s::periodicity_and_pattern_r16_c_::types_opts::to_number() const
{
  static const uint8_t numbers[] = {2, 4, 5, 8, 10, 20, 40};
  return map_enum_number(numbers, 7, value, "invalid_symbol_pattern_r16_s::periodicity_and_pattern_r16_c_::types");
}

// MPE-Resource-r17 ::= SEQUENCE
SRSASN_CODE mpe_res_r17_s::pack(bit_ref& bref) const
{
  HANDLE_CODE(bref.pack(cell_r17_present, 1));
  HANDLE_CODE(bref.pack(add_pci_r17_present, 1));

  HANDLE_CODE(pack_integer(bref, mpe_res_id_r17, (uint8_t)1u, (uint8_t)64u));
  if (cell_r17_present) {
    HANDLE_CODE(pack_integer(bref, cell_r17, (uint8_t)0u, (uint8_t)31u));
  }
  if (add_pci_r17_present) {
    HANDLE_CODE(pack_integer(bref, add_pci_r17, (uint8_t)1u, (uint8_t)7u));
  }
  HANDLE_CODE(mpe_ref_sig_r17.pack(bref));

  return SRSASN_SUCCESS;
}
SRSASN_CODE mpe_res_r17_s::unpack(cbit_ref& bref)
{
  HANDLE_CODE(bref.unpack(cell_r17_present, 1));
  HANDLE_CODE(bref.unpack(add_pci_r17_present, 1));

  HANDLE_CODE(unpack_integer(mpe_res_id_r17, bref, (uint8_t)1u, (uint8_t)64u));
  if (cell_r17_present) {
    HANDLE_CODE(unpack_integer(cell_r17, bref, (uint8_t)0u, (uint8_t)31u));
  }
  if (add_pci_r17_present) {
    HANDLE_CODE(unpack_integer(add_pci_r17, bref, (uint8_t)1u, (uint8_t)7u));
  }
  HANDLE_CODE(mpe_ref_sig_r17.unpack(bref));

  return SRSASN_SUCCESS;
}
void mpe_res_r17_s::to_json(json_writer& j) const
{
  j.start_obj();
  j.write_int("mpe-ResourceId-r17", mpe_res_id_r17);
  if (cell_r17_present) {
    j.write_int("cell-r17", cell_r17);
  }
  if (add_pci_r17_present) {
    j.write_int("additionalPCI-r17", add_pci_r17);
  }
  j.write_fieldname("mpe-ReferenceSignal-r17");
  mpe_ref_sig_r17.to_json(j);
  j.end_obj();
}

void mpe_res_r17_s::mpe_ref_sig_r17_c_::destroy_() {}
void mpe_res_r17_s::mpe_ref_sig_r17_c_::set(types::options e)
{
  destroy_();
  type_ = e;
}
mpe_res_r17_s::mpe_ref_sig_r17_c_::mpe_ref_sig_r17_c_(const mpe_res_r17_s::mpe_ref_sig_r17_c_& other)
{
  type_ = other.type();
  switch (type_) {
    case types::csi_rs_res_r17:
      c.init(other.c.get<uint8_t>());
      break;
    case types::ssb_res_r17:
      c.init(other.c.get<uint8_t>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "mpe_res_r17_s::mpe_ref_sig_r17_c_");
  }
}
mpe_res_r17_s::mpe_ref_sig_r17_c_&
mpe_res_r17_s::mpe_ref_sig_r17_c_::operator=(const mpe_res_r17_s::mpe_ref_sig_r17_c_& other)
{
  if (this == &other) {
    return *this;
  }
  set(other.type());
  switch (type_) {
    case types::csi_rs_res_r17:
      c.set(other.c.get<uint8_t>());
      break;
    case types::ssb_res_r17:
      c.set(other.c.get<uint8_t>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "mpe_res_r17_s::mpe_ref_sig_r17_c_");
  }

  return *this;
}
uint8_t& mpe_res_r17_s::mpe_ref_sig_r17_c_::set_csi_rs_res_r17()
{
  set(types::csi_rs_res_r17);
  return c.get<uint8_t>();
}
uint8_t& mpe_res_r17_s::mpe_ref_sig_r17_c_::set_ssb_res_r17()
{
  set(types::ssb_res_r17);
  return c.get<uint8_t>();
}
void mpe_res_r17_s::mpe_ref_sig_r17_c_::to_json(json_writer& j) const
{
  j.start_obj();
  switch (type_) {
    case types::csi_rs_res_r17:
      j.write_int("csi-RS-Resource-r17", c.get<uint8_t>());
      break;
    case types::ssb_res_r17:
      j.write_int("ssb-Resource-r17", c.get<uint8_t>());
      break;
    default:
      log_invalid_choice_id(type_, "mpe_res_r17_s::mpe_ref_sig_r17_c_");
  }
  j.end_obj();
}
SRSASN_CODE mpe_res_r17_s::mpe_ref_sig_r17_c_::pack(bit_ref& bref) const
{
  type_.pack(bref);
  switch (type_) {
    case types::csi_rs_res_r17:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)191u));
      break;
    case types::ssb_res_r17:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)63u));
      break;
    default:
      log_invalid_choice_id(type_, "mpe_res_r17_s::mpe_ref_sig_r17_c_");
      return SRSASN_ERROR_ENCODE_FAIL;
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE mpe_res_r17_s::mpe_ref_sig_r17_c_::unpack(cbit_ref& bref)
{
  types e;
  e.unpack(bref);
  set(e);
  switch (type_) {
    case types::csi_rs_res_r17:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)191u));
      break;
    case types::ssb_res_r17:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)63u));
      break;
    default:
      log_invalid_choice_id(type_, "mpe_res_r17_s::mpe_ref_sig_r17_c_");
      return SRSASN_ERROR_DECODE_FAIL;
  }
  return SRSASN_SUCCESS;
}

const char* mpe_res_r17_s::mpe_ref_sig_r17_c_::types_opts::to_string() const
{
  static const char* names[] = {"csi-RS-Resource-r17", "ssb-Resource-r17"};
  return convert_enum_idx(names, 2, value, "mpe_res_r17_s::mpe_ref_sig_r17_c_::types");
}

// PUCCH-Config ::= SEQUENCE
SRSASN_CODE pucch_cfg_s::pack(bit_ref& bref) const
{
  bref.pack(ext, 1);
  HANDLE_CODE(bref.pack(res_set_to_add_mod_list.size() > 0, 1));
  HANDLE_CODE(bref.pack(res_set_to_release_list.size() > 0, 1));
  HANDLE_CODE(bref.pack(res_to_add_mod_list.size() > 0, 1));
  HANDLE_CODE(bref.pack(res_to_release_list.size() > 0, 1));
  HANDLE_CODE(bref.pack(format1_present, 1));
  HANDLE_CODE(bref.pack(format2_present, 1));
  HANDLE_CODE(bref.pack(format3_present, 1));
  HANDLE_CODE(bref.pack(format4_present, 1));
  HANDLE_CODE(bref.pack(sched_request_res_to_add_mod_list.size() > 0, 1));
  HANDLE_CODE(bref.pack(sched_request_res_to_release_list.size() > 0, 1));
  HANDLE_CODE(bref.pack(multi_csi_pucch_res_list.size() > 0, 1));
  HANDLE_CODE(bref.pack(dl_data_to_ul_ack.size() > 0, 1));
  HANDLE_CODE(bref.pack(spatial_relation_info_to_add_mod_list.size() > 0, 1));
  HANDLE_CODE(bref.pack(spatial_relation_info_to_release_list.size() > 0, 1));
  HANDLE_CODE(bref.pack(pucch_pwr_ctrl_present, 1));

  if (res_set_to_add_mod_list.size() > 0) {
    HANDLE_CODE(pack_dyn_seq_of(bref, res_set_to_add_mod_list, 1, 4));
  }
  if (res_set_to_release_list.size() > 0) {
    HANDLE_CODE(pack_dyn_seq_of(bref, res_set_to_release_list, 1, 4, integer_packer<uint8_t>(0, 3)));
  }
  if (res_to_add_mod_list.size() > 0) {
    HANDLE_CODE(pack_dyn_seq_of(bref, res_to_add_mod_list, 1, 128));
  }
  if (res_to_release_list.size() > 0) {
    HANDLE_CODE(pack_dyn_seq_of(bref, res_to_release_list, 1, 128, integer_packer<uint8_t>(0, 127)));
  }
  if (format1_present) {
    HANDLE_CODE(format1.pack(bref));
  }
  if (format2_present) {
    HANDLE_CODE(format2.pack(bref));
  }
  if (format3_present) {
    HANDLE_CODE(format3.pack(bref));
  }
  if (format4_present) {
    HANDLE_CODE(format4.pack(bref));
  }
  if (sched_request_res_to_add_mod_list.size() > 0) {
    HANDLE_CODE(pack_dyn_seq_of(bref, sched_request_res_to_add_mod_list, 1, 8));
  }
  if (sched_request_res_to_release_list.size() > 0) {
    HANDLE_CODE(pack_dyn_seq_of(bref, sched_request_res_to_release_list, 1, 8, integer_packer<uint8_t>(1, 8)));
  }
  if (multi_csi_pucch_res_list.size() > 0) {
    HANDLE_CODE(pack_dyn_seq_of(bref, multi_csi_pucch_res_list, 1, 2, integer_packer<uint8_t>(0, 127)));
  }
  if (dl_data_to_ul_ack.size() > 0) {
    HANDLE_CODE(pack_dyn_seq_of(bref, dl_data_to_ul_ack, 1, 8, integer_packer<uint8_t>(0, 15)));
  }
  if (spatial_relation_info_to_add_mod_list.size() > 0) {
    HANDLE_CODE(pack_dyn_seq_of(bref, spatial_relation_info_to_add_mod_list, 1, 8));
  }
  if (spatial_relation_info_to_release_list.size() > 0) {
    HANDLE_CODE(pack_dyn_seq_of(bref, spatial_relation_info_to_release_list, 1, 8, integer_packer<uint8_t>(1, 8)));
  }
  if (pucch_pwr_ctrl_present) {
    HANDLE_CODE(pucch_pwr_ctrl.pack(bref));
  }

  if (ext) {
    ext_groups_packer_guard group_flags;
    group_flags[0] |= res_to_add_mod_list_ext_v1610.is_present();
    group_flags[0] |= dl_data_to_ul_ack_r16.is_present();
    group_flags[0] |= ul_access_cfg_list_dci_1_1_r16.is_present();
    group_flags[0] |= subslot_len_for_pucch_r16.is_present();
    group_flags[0] |= dl_data_to_ul_ack_dci_1_2_r16.is_present();
    group_flags[0] |= nof_bits_for_pucch_res_ind_dci_1_2_r16_present;
    group_flags[0] |= dmrs_ul_transform_precoding_pucch_r16_present;
    group_flags[0] |= spatial_relation_info_to_add_mod_list_size_ext_v1610.is_present();
    group_flags[0] |= spatial_relation_info_to_release_list_size_ext_v1610.is_present();
    group_flags[0] |= spatial_relation_info_to_add_mod_list_ext_v1610.is_present();
    group_flags[0] |= spatial_relation_info_to_release_list_ext_v1610.is_present();
    group_flags[0] |= res_group_to_add_mod_list_r16.is_present();
    group_flags[0] |= res_group_to_release_list_r16.is_present();
    group_flags[0] |= sps_pucch_an_list_r16.is_present();
    group_flags[0] |= sched_request_res_to_add_mod_list_ext_v1610.is_present();
    group_flags[1] |= format0_r17.is_present();
    group_flags[1] |= format2_ext_r17.is_present();
    group_flags[1] |= format3_ext_r17.is_present();
    group_flags[1] |= format4_ext_r17.is_present();
    group_flags[1] |= ul_access_cfg_list_dci_1_2_r17.is_present();
    group_flags[1] |= map_pattern_r17_present;
    group_flags[1] |= pwr_ctrl_set_info_to_add_mod_list_r17.is_present();
    group_flags[1] |= pwr_ctrl_set_info_to_release_list_r17.is_present();
    group_flags[1] |= second_tpc_field_dci_1_1_r17_present;
    group_flags[1] |= second_tpc_field_dci_1_2_r17_present;
    group_flags[1] |= dl_data_to_ul_ack_r17.is_present();
    group_flags[1] |= dl_data_to_ul_ack_dci_1_2_r17.is_present();
    group_flags[1] |= ul_access_cfg_list_dci_1_1_r17.is_present();
    group_flags[1] |= sched_request_res_to_add_mod_list_ext_v1700.is_present();
    group_flags[1] |= dmrs_bundling_pucch_cfg_r17.is_present();
    group_flags[1] |= dl_data_to_ul_ack_v1700.is_present();
    group_flags[1] |= dl_data_to_ul_ack_multicast_dci_format4_1_r17.is_present();
    group_flags[1] |= sps_pucch_an_list_multicast_r17.is_present();
    group_flags.pack(bref);

    if (group_flags[0]) {
      varlength_field_pack_guard varlen_scope(bref, false);

      HANDLE_CODE(bref.pack(res_to_add_mod_list_ext_v1610.is_present(), 1));
      HANDLE_CODE(bref.pack(dl_data_to_ul_ack_r16.is_present(), 1));
      HANDLE_CODE(bref.pack(ul_access_cfg_list_dci_1_1_r16.is_present(), 1));
      HANDLE_CODE(bref.pack(subslot_len_for_pucch_r16.is_present(), 1));
      HANDLE_CODE(bref.pack(dl_data_to_ul_ack_dci_1_2_r16.is_present(), 1));
      HANDLE_CODE(bref.pack(nof_bits_for_pucch_res_ind_dci_1_2_r16_present, 1));
      HANDLE_CODE(bref.pack(dmrs_ul_transform_precoding_pucch_r16_present, 1));
      HANDLE_CODE(bref.pack(spatial_relation_info_to_add_mod_list_size_ext_v1610.is_present(), 1));
      HANDLE_CODE(bref.pack(spatial_relation_info_to_release_list_size_ext_v1610.is_present(), 1));
      HANDLE_CODE(bref.pack(spatial_relation_info_to_add_mod_list_ext_v1610.is_present(), 1));
      HANDLE_CODE(bref.pack(spatial_relation_info_to_release_list_ext_v1610.is_present(), 1));
      HANDLE_CODE(bref.pack(res_group_to_add_mod_list_r16.is_present(), 1));
      HANDLE_CODE(bref.pack(res_group_to_release_list_r16.is_present(), 1));
      HANDLE_CODE(bref.pack(sps_pucch_an_list_r16.is_present(), 1));
      HANDLE_CODE(bref.pack(sched_request_res_to_add_mod_list_ext_v1610.is_present(), 1));
      if (res_to_add_mod_list_ext_v1610.is_present()) {
        HANDLE_CODE(pack_dyn_seq_of(bref, *res_to_add_mod_list_ext_v1610, 1, 128));
      }
      if (dl_data_to_ul_ack_r16.is_present()) {
        HANDLE_CODE(dl_data_to_ul_ack_r16->pack(bref));
      }
      if (ul_access_cfg_list_dci_1_1_r16.is_present()) {
        HANDLE_CODE(ul_access_cfg_list_dci_1_1_r16->pack(bref));
      }
      if (subslot_len_for_pucch_r16.is_present()) {
        HANDLE_CODE(subslot_len_for_pucch_r16->pack(bref));
      }
      if (dl_data_to_ul_ack_dci_1_2_r16.is_present()) {
        HANDLE_CODE(dl_data_to_ul_ack_dci_1_2_r16->pack(bref));
      }
      if (nof_bits_for_pucch_res_ind_dci_1_2_r16_present) {
        HANDLE_CODE(pack_integer(bref, nof_bits_for_pucch_res_ind_dci_1_2_r16, (uint8_t)0u, (uint8_t)3u));
      }
      if (spatial_relation_info_to_add_mod_list_size_ext_v1610.is_present()) {
        HANDLE_CODE(pack_dyn_seq_of(bref, *spatial_relation_info_to_add_mod_list_size_ext_v1610, 1, 56));
      }
      if (spatial_relation_info_to_release_list_size_ext_v1610.is_present()) {
        HANDLE_CODE(pack_dyn_seq_of(
            bref, *spatial_relation_info_to_release_list_size_ext_v1610, 1, 56, integer_packer<uint8_t>(1, 8)));
      }
      if (spatial_relation_info_to_add_mod_list_ext_v1610.is_present()) {
        HANDLE_CODE(pack_dyn_seq_of(bref, *spatial_relation_info_to_add_mod_list_ext_v1610, 1, 64));
      }
      if (spatial_relation_info_to_release_list_ext_v1610.is_present()) {
        HANDLE_CODE(pack_dyn_seq_of(
            bref, *spatial_relation_info_to_release_list_ext_v1610, 1, 64, integer_packer<uint8_t>(1, 64)));
      }
      if (res_group_to_add_mod_list_r16.is_present()) {
        HANDLE_CODE(pack_dyn_seq_of(bref, *res_group_to_add_mod_list_r16, 1, 4));
      }
      if (res_group_to_release_list_r16.is_present()) {
        HANDLE_CODE(pack_dyn_seq_of(bref, *res_group_to_release_list_r16, 1, 4, integer_packer<uint8_t>(0, 3)));
      }
      if (sps_pucch_an_list_r16.is_present()) {
        HANDLE_CODE(sps_pucch_an_list_r16->pack(bref));
      }
      if (sched_request_res_to_add_mod_list_ext_v1610.is_present()) {
        HANDLE_CODE(pack_dyn_seq_of(bref, *sched_request_res_to_add_mod_list_ext_v1610, 1, 8));
      }
    }
    if (group_flags[1]) {
      varlength_field_pack_guard varlen_scope(bref, false);

      HANDLE_CODE(bref.pack(format0_r17.is_present(), 1));
      HANDLE_CODE(bref.pack(format2_ext_r17.is_present(), 1));
      HANDLE_CODE(bref.pack(format3_ext_r17.is_present(), 1));
      HANDLE_CODE(bref.pack(format4_ext_r17.is_present(), 1));
      HANDLE_CODE(bref.pack(ul_access_cfg_list_dci_1_2_r17.is_present(), 1));
      HANDLE_CODE(bref.pack(map_pattern_r17_present, 1));
      HANDLE_CODE(bref.pack(pwr_ctrl_set_info_to_add_mod_list_r17.is_present(), 1));
      HANDLE_CODE(bref.pack(pwr_ctrl_set_info_to_release_list_r17.is_present(), 1));
      HANDLE_CODE(bref.pack(second_tpc_field_dci_1_1_r17_present, 1));
      HANDLE_CODE(bref.pack(second_tpc_field_dci_1_2_r17_present, 1));
      HANDLE_CODE(bref.pack(dl_data_to_ul_ack_r17.is_present(), 1));
      HANDLE_CODE(bref.pack(dl_data_to_ul_ack_dci_1_2_r17.is_present(), 1));
      HANDLE_CODE(bref.pack(ul_access_cfg_list_dci_1_1_r17.is_present(), 1));
      HANDLE_CODE(bref.pack(sched_request_res_to_add_mod_list_ext_v1700.is_present(), 1));
      HANDLE_CODE(bref.pack(dmrs_bundling_pucch_cfg_r17.is_present(), 1));
      HANDLE_CODE(bref.pack(dl_data_to_ul_ack_v1700.is_present(), 1));
      HANDLE_CODE(bref.pack(dl_data_to_ul_ack_multicast_dci_format4_1_r17.is_present(), 1));
      HANDLE_CODE(bref.pack(sps_pucch_an_list_multicast_r17.is_present(), 1));
      if (format0_r17.is_present()) {
        HANDLE_CODE(format0_r17->pack(bref));
      }
      if (format2_ext_r17.is_present()) {
        HANDLE_CODE(format2_ext_r17->pack(bref));
      }
      if (format3_ext_r17.is_present()) {
        HANDLE_CODE(format3_ext_r17->pack(bref));
      }
      if (format4_ext_r17.is_present()) {
        HANDLE_CODE(format4_ext_r17->pack(bref));
      }
      if (ul_access_cfg_list_dci_1_2_r17.is_present()) {
        HANDLE_CODE(ul_access_cfg_list_dci_1_2_r17->pack(bref));
      }
      if (map_pattern_r17_present) {
        HANDLE_CODE(map_pattern_r17.pack(bref));
      }
      if (pwr_ctrl_set_info_to_add_mod_list_r17.is_present()) {
        HANDLE_CODE(pack_dyn_seq_of(bref, *pwr_ctrl_set_info_to_add_mod_list_r17, 1, 8));
      }
      if (pwr_ctrl_set_info_to_release_list_r17.is_present()) {
        HANDLE_CODE(pack_dyn_seq_of(bref, *pwr_ctrl_set_info_to_release_list_r17, 1, 8, integer_packer<uint8_t>(1, 8)));
      }
      if (dl_data_to_ul_ack_r17.is_present()) {
        HANDLE_CODE(dl_data_to_ul_ack_r17->pack(bref));
      }
      if (dl_data_to_ul_ack_dci_1_2_r17.is_present()) {
        HANDLE_CODE(dl_data_to_ul_ack_dci_1_2_r17->pack(bref));
      }
      if (ul_access_cfg_list_dci_1_1_r17.is_present()) {
        HANDLE_CODE(ul_access_cfg_list_dci_1_1_r17->pack(bref));
      }
      if (sched_request_res_to_add_mod_list_ext_v1700.is_present()) {
        HANDLE_CODE(pack_dyn_seq_of(bref, *sched_request_res_to_add_mod_list_ext_v1700, 1, 8));
      }
      if (dmrs_bundling_pucch_cfg_r17.is_present()) {
        HANDLE_CODE(dmrs_bundling_pucch_cfg_r17->pack(bref));
      }
      if (dl_data_to_ul_ack_v1700.is_present()) {
        HANDLE_CODE(dl_data_to_ul_ack_v1700->pack(bref));
      }
      if (dl_data_to_ul_ack_multicast_dci_format4_1_r17.is_present()) {
        HANDLE_CODE(dl_data_to_ul_ack_multicast_dci_format4_1_r17->pack(bref));
      }
      if (sps_pucch_an_list_multicast_r17.is_present()) {
        HANDLE_CODE(sps_pucch_an_list_multicast_r17->pack(bref));
      }
    }
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE pucch_cfg_s::unpack(cbit_ref& bref)
{
  bref.unpack(ext, 1);
  bool res_set_to_add_mod_list_present;
  HANDLE_CODE(bref.unpack(res_set_to_add_mod_list_present, 1));
  bool res_set_to_release_list_present;
  HANDLE_CODE(bref.unpack(res_set_to_release_list_present, 1));
  bool res_to_add_mod_list_present;
  HANDLE_CODE(bref.unpack(res_to_add_mod_list_present, 1));
  bool res_to_release_list_present;
  HANDLE_CODE(bref.unpack(res_to_release_list_present, 1));
  HANDLE_CODE(bref.unpack(format1_present, 1));
  HANDLE_CODE(bref.unpack(format2_present, 1));
  HANDLE_CODE(bref.unpack(format3_present, 1));
  HANDLE_CODE(bref.unpack(format4_present, 1));
  bool sched_request_res_to_add_mod_list_present;
  HANDLE_CODE(bref.unpack(sched_request_res_to_add_mod_list_present, 1));
  bool sched_request_res_to_release_list_present;
  HANDLE_CODE(bref.unpack(sched_request_res_to_release_list_present, 1));
  bool multi_csi_pucch_res_list_present;
  HANDLE_CODE(bref.unpack(multi_csi_pucch_res_list_present, 1));
  bool dl_data_to_ul_ack_present;
  HANDLE_CODE(bref.unpack(dl_data_to_ul_ack_present, 1));
  bool spatial_relation_info_to_add_mod_list_present;
  HANDLE_CODE(bref.unpack(spatial_relation_info_to_add_mod_list_present, 1));
  bool spatial_relation_info_to_release_list_present;
  HANDLE_CODE(bref.unpack(spatial_relation_info_to_release_list_present, 1));
  HANDLE_CODE(bref.unpack(pucch_pwr_ctrl_present, 1));

  if (res_set_to_add_mod_list_present) {
    HANDLE_CODE(unpack_dyn_seq_of(res_set_to_add_mod_list, bref, 1, 4));
  }
  if (res_set_to_release_list_present) {
    HANDLE_CODE(unpack_dyn_seq_of(res_set_to_release_list, bref, 1, 4, integer_packer<uint8_t>(0, 3)));
  }
  if (res_to_add_mod_list_present) {
    HANDLE_CODE(unpack_dyn_seq_of(res_to_add_mod_list, bref, 1, 128));
  }
  if (res_to_release_list_present) {
    HANDLE_CODE(unpack_dyn_seq_of(res_to_release_list, bref, 1, 128, integer_packer<uint8_t>(0, 127)));
  }
  if (format1_present) {
    HANDLE_CODE(format1.unpack(bref));
  }
  if (format2_present) {
    HANDLE_CODE(format2.unpack(bref));
  }
  if (format3_present) {
    HANDLE_CODE(format3.unpack(bref));
  }
  if (format4_present) {
    HANDLE_CODE(format4.unpack(bref));
  }
  if (sched_request_res_to_add_mod_list_present) {
    HANDLE_CODE(unpack_dyn_seq_of(sched_request_res_to_add_mod_list, bref, 1, 8));
  }
  if (sched_request_res_to_release_list_present) {
    HANDLE_CODE(unpack_dyn_seq_of(sched_request_res_to_release_list, bref, 1, 8, integer_packer<uint8_t>(1, 8)));
  }
  if (multi_csi_pucch_res_list_present) {
    HANDLE_CODE(unpack_dyn_seq_of(multi_csi_pucch_res_list, bref, 1, 2, integer_packer<uint8_t>(0, 127)));
  }
  if (dl_data_to_ul_ack_present) {
    HANDLE_CODE(unpack_dyn_seq_of(dl_data_to_ul_ack, bref, 1, 8, integer_packer<uint8_t>(0, 15)));
  }
  if (spatial_relation_info_to_add_mod_list_present) {
    HANDLE_CODE(unpack_dyn_seq_of(spatial_relation_info_to_add_mod_list, bref, 1, 8));
  }
  if (spatial_relation_info_to_release_list_present) {
    HANDLE_CODE(unpack_dyn_seq_of(spatial_relation_info_to_release_list, bref, 1, 8, integer_packer<uint8_t>(1, 8)));
  }
  if (pucch_pwr_ctrl_present) {
    HANDLE_CODE(pucch_pwr_ctrl.unpack(bref));
  }

  if (ext) {
    ext_groups_unpacker_guard group_flags(2);
    group_flags.unpack(bref);

    if (group_flags[0]) {
      varlength_field_unpack_guard varlen_scope(bref, false);

      unpack_presence_flag(res_to_add_mod_list_ext_v1610, bref);
      unpack_presence_flag(dl_data_to_ul_ack_r16, bref);
      unpack_presence_flag(ul_access_cfg_list_dci_1_1_r16, bref);
      unpack_presence_flag(subslot_len_for_pucch_r16, bref);
      unpack_presence_flag(dl_data_to_ul_ack_dci_1_2_r16, bref);
      HANDLE_CODE(bref.unpack(nof_bits_for_pucch_res_ind_dci_1_2_r16_present, 1));
      HANDLE_CODE(bref.unpack(dmrs_ul_transform_precoding_pucch_r16_present, 1));
      unpack_presence_flag(spatial_relation_info_to_add_mod_list_size_ext_v1610, bref);
      unpack_presence_flag(spatial_relation_info_to_release_list_size_ext_v1610, bref);
      unpack_presence_flag(spatial_relation_info_to_add_mod_list_ext_v1610, bref);
      unpack_presence_flag(spatial_relation_info_to_release_list_ext_v1610, bref);
      unpack_presence_flag(res_group_to_add_mod_list_r16, bref);
      unpack_presence_flag(res_group_to_release_list_r16, bref);
      unpack_presence_flag(sps_pucch_an_list_r16, bref);
      unpack_presence_flag(sched_request_res_to_add_mod_list_ext_v1610, bref);
      if (res_to_add_mod_list_ext_v1610.is_present()) {
        HANDLE_CODE(unpack_dyn_seq_of(*res_to_add_mod_list_ext_v1610, bref, 1, 128));
      }
      if (dl_data_to_ul_ack_r16.is_present()) {
        HANDLE_CODE(dl_data_to_ul_ack_r16->unpack(bref));
      }
      if (ul_access_cfg_list_dci_1_1_r16.is_present()) {
        HANDLE_CODE(ul_access_cfg_list_dci_1_1_r16->unpack(bref));
      }
      if (subslot_len_for_pucch_r16.is_present()) {
        HANDLE_CODE(subslot_len_for_pucch_r16->unpack(bref));
      }
      if (dl_data_to_ul_ack_dci_1_2_r16.is_present()) {
        HANDLE_CODE(dl_data_to_ul_ack_dci_1_2_r16->unpack(bref));
      }
      if (nof_bits_for_pucch_res_ind_dci_1_2_r16_present) {
        HANDLE_CODE(unpack_integer(nof_bits_for_pucch_res_ind_dci_1_2_r16, bref, (uint8_t)0u, (uint8_t)3u));
      }
      if (spatial_relation_info_to_add_mod_list_size_ext_v1610.is_present()) {
        HANDLE_CODE(unpack_dyn_seq_of(*spatial_relation_info_to_add_mod_list_size_ext_v1610, bref, 1, 56));
      }
      if (spatial_relation_info_to_release_list_size_ext_v1610.is_present()) {
        HANDLE_CODE(unpack_dyn_seq_of(
            *spatial_relation_info_to_release_list_size_ext_v1610, bref, 1, 56, integer_packer<uint8_t>(1, 8)));
      }
      if (spatial_relation_info_to_add_mod_list_ext_v1610.is_present()) {
        HANDLE_CODE(unpack_dyn_seq_of(*spatial_relation_info_to_add_mod_list_ext_v1610, bref, 1, 64));
      }
      if (spatial_relation_info_to_release_list_ext_v1610.is_present()) {
        HANDLE_CODE(unpack_dyn_seq_of(
            *spatial_relation_info_to_release_list_ext_v1610, bref, 1, 64, integer_packer<uint8_t>(1, 64)));
      }
      if (res_group_to_add_mod_list_r16.is_present()) {
        HANDLE_CODE(unpack_dyn_seq_of(*res_group_to_add_mod_list_r16, bref, 1, 4));
      }
      if (res_group_to_release_list_r16.is_present()) {
        HANDLE_CODE(unpack_dyn_seq_of(*res_group_to_release_list_r16, bref, 1, 4, integer_packer<uint8_t>(0, 3)));
      }
      if (sps_pucch_an_list_r16.is_present()) {
        HANDLE_CODE(sps_pucch_an_list_r16->unpack(bref));
      }
      if (sched_request_res_to_add_mod_list_ext_v1610.is_present()) {
        HANDLE_CODE(unpack_dyn_seq_of(*sched_request_res_to_add_mod_list_ext_v1610, bref, 1, 8));
      }
    }
    if (group_flags[1]) {
      varlength_field_unpack_guard varlen_scope(bref, false);

      unpack_presence_flag(format0_r17, bref);
      unpack_presence_flag(format2_ext_r17, bref);
      unpack_presence_flag(format3_ext_r17, bref);
      unpack_presence_flag(format4_ext_r17, bref);
      unpack_presence_flag(ul_access_cfg_list_dci_1_2_r17, bref);
      HANDLE_CODE(bref.unpack(map_pattern_r17_present, 1));
      unpack_presence_flag(pwr_ctrl_set_info_to_add_mod_list_r17, bref);
      unpack_presence_flag(pwr_ctrl_set_info_to_release_list_r17, bref);
      HANDLE_CODE(bref.unpack(second_tpc_field_dci_1_1_r17_present, 1));
      HANDLE_CODE(bref.unpack(second_tpc_field_dci_1_2_r17_present, 1));
      unpack_presence_flag(dl_data_to_ul_ack_r17, bref);
      unpack_presence_flag(dl_data_to_ul_ack_dci_1_2_r17, bref);
      unpack_presence_flag(ul_access_cfg_list_dci_1_1_r17, bref);
      unpack_presence_flag(sched_request_res_to_add_mod_list_ext_v1700, bref);
      unpack_presence_flag(dmrs_bundling_pucch_cfg_r17, bref);
      unpack_presence_flag(dl_data_to_ul_ack_v1700, bref);
      unpack_presence_flag(dl_data_to_ul_ack_multicast_dci_format4_1_r17, bref);
      unpack_presence_flag(sps_pucch_an_list_multicast_r17, bref);
      if (format0_r17.is_present()) {
        HANDLE_CODE(format0_r17->unpack(bref));
      }
      if (format2_ext_r17.is_present()) {
        HANDLE_CODE(format2_ext_r17->unpack(bref));
      }
      if (format3_ext_r17.is_present()) {
        HANDLE_CODE(format3_ext_r17->unpack(bref));
      }
      if (format4_ext_r17.is_present()) {
        HANDLE_CODE(format4_ext_r17->unpack(bref));
      }
      if (ul_access_cfg_list_dci_1_2_r17.is_present()) {
        HANDLE_CODE(ul_access_cfg_list_dci_1_2_r17->unpack(bref));
      }
      if (map_pattern_r17_present) {
        HANDLE_CODE(map_pattern_r17.unpack(bref));
      }
      if (pwr_ctrl_set_info_to_add_mod_list_r17.is_present()) {
        HANDLE_CODE(unpack_dyn_seq_of(*pwr_ctrl_set_info_to_add_mod_list_r17, bref, 1, 8));
      }
      if (pwr_ctrl_set_info_to_release_list_r17.is_present()) {
        HANDLE_CODE(
            unpack_dyn_seq_of(*pwr_ctrl_set_info_to_release_list_r17, bref, 1, 8, integer_packer<uint8_t>(1, 8)));
      }
      if (dl_data_to_ul_ack_r17.is_present()) {
        HANDLE_CODE(dl_data_to_ul_ack_r17->unpack(bref));
      }
      if (dl_data_to_ul_ack_dci_1_2_r17.is_present()) {
        HANDLE_CODE(dl_data_to_ul_ack_dci_1_2_r17->unpack(bref));
      }
      if (ul_access_cfg_list_dci_1_1_r17.is_present()) {
        HANDLE_CODE(ul_access_cfg_list_dci_1_1_r17->unpack(bref));
      }
      if (sched_request_res_to_add_mod_list_ext_v1700.is_present()) {
        HANDLE_CODE(unpack_dyn_seq_of(*sched_request_res_to_add_mod_list_ext_v1700, bref, 1, 8));
      }
      if (dmrs_bundling_pucch_cfg_r17.is_present()) {
        HANDLE_CODE(dmrs_bundling_pucch_cfg_r17->unpack(bref));
      }
      if (dl_data_to_ul_ack_v1700.is_present()) {
        HANDLE_CODE(dl_data_to_ul_ack_v1700->unpack(bref));
      }
      if (dl_data_to_ul_ack_multicast_dci_format4_1_r17.is_present()) {
        HANDLE_CODE(dl_data_to_ul_ack_multicast_dci_format4_1_r17->unpack(bref));
      }
      if (sps_pucch_an_list_multicast_r17.is_present()) {
        HANDLE_CODE(sps_pucch_an_list_multicast_r17->unpack(bref));
      }
    }
  }
  return SRSASN_SUCCESS;
}
void pucch_cfg_s::to_json(json_writer& j) const
{
  j.start_obj();
  if (res_set_to_add_mod_list.size() > 0) {
    j.start_array("resourceSetToAddModList");
    for (const auto& e1 : res_set_to_add_mod_list) {
      e1.to_json(j);
    }
    j.end_array();
  }
  if (res_set_to_release_list.size() > 0) {
    j.start_array("resourceSetToReleaseList");
    for (const auto& e1 : res_set_to_release_list) {
      j.write_int(e1);
    }
    j.end_array();
  }
  if (res_to_add_mod_list.size() > 0) {
    j.start_array("resourceToAddModList");
    for (const auto& e1 : res_to_add_mod_list) {
      e1.to_json(j);
    }
    j.end_array();
  }
  if (res_to_release_list.size() > 0) {
    j.start_array("resourceToReleaseList");
    for (const auto& e1 : res_to_release_list) {
      j.write_int(e1);
    }
    j.end_array();
  }
  if (format1_present) {
    j.write_fieldname("format1");
    format1.to_json(j);
  }
  if (format2_present) {
    j.write_fieldname("format2");
    format2.to_json(j);
  }
  if (format3_present) {
    j.write_fieldname("format3");
    format3.to_json(j);
  }
  if (format4_present) {
    j.write_fieldname("format4");
    format4.to_json(j);
  }
  if (sched_request_res_to_add_mod_list.size() > 0) {
    j.start_array("schedulingRequestResourceToAddModList");
    for (const auto& e1 : sched_request_res_to_add_mod_list) {
      e1.to_json(j);
    }
    j.end_array();
  }
  if (sched_request_res_to_release_list.size() > 0) {
    j.start_array("schedulingRequestResourceToReleaseList");
    for (const auto& e1 : sched_request_res_to_release_list) {
      j.write_int(e1);
    }
    j.end_array();
  }
  if (multi_csi_pucch_res_list.size() > 0) {
    j.start_array("multi-CSI-PUCCH-ResourceList");
    for (const auto& e1 : multi_csi_pucch_res_list) {
      j.write_int(e1);
    }
    j.end_array();
  }
  if (dl_data_to_ul_ack.size() > 0) {
    j.start_array("dl-DataToUL-ACK");
    for (const auto& e1 : dl_data_to_ul_ack) {
      j.write_int(e1);
    }
    j.end_array();
  }
  if (spatial_relation_info_to_add_mod_list.size() > 0) {
    j.start_array("spatialRelationInfoToAddModList");
    for (const auto& e1 : spatial_relation_info_to_add_mod_list) {
      e1.to_json(j);
    }
    j.end_array();
  }
  if (spatial_relation_info_to_release_list.size() > 0) {
    j.start_array("spatialRelationInfoToReleaseList");
    for (const auto& e1 : spatial_relation_info_to_release_list) {
      j.write_int(e1);
    }
    j.end_array();
  }
  if (pucch_pwr_ctrl_present) {
    j.write_fieldname("pucch-PowerControl");
    pucch_pwr_ctrl.to_json(j);
  }
  if (ext) {
    if (res_to_add_mod_list_ext_v1610.is_present()) {
      j.start_array("resourceToAddModListExt-v1610");
      for (const auto& e1 : *res_to_add_mod_list_ext_v1610) {
        e1.to_json(j);
      }
      j.end_array();
    }
    if (dl_data_to_ul_ack_r16.is_present()) {
      j.write_fieldname("dl-DataToUL-ACK-r16");
      dl_data_to_ul_ack_r16->to_json(j);
    }
    if (ul_access_cfg_list_dci_1_1_r16.is_present()) {
      j.write_fieldname("ul-AccessConfigListDCI-1-1-r16");
      ul_access_cfg_list_dci_1_1_r16->to_json(j);
    }
    if (subslot_len_for_pucch_r16.is_present()) {
      j.write_fieldname("subslotLengthForPUCCH-r16");
      subslot_len_for_pucch_r16->to_json(j);
    }
    if (dl_data_to_ul_ack_dci_1_2_r16.is_present()) {
      j.write_fieldname("dl-DataToUL-ACK-DCI-1-2-r16");
      dl_data_to_ul_ack_dci_1_2_r16->to_json(j);
    }
    if (nof_bits_for_pucch_res_ind_dci_1_2_r16_present) {
      j.write_int("numberOfBitsForPUCCH-ResourceIndicatorDCI-1-2-r16", nof_bits_for_pucch_res_ind_dci_1_2_r16);
    }
    if (dmrs_ul_transform_precoding_pucch_r16_present) {
      j.write_str("dmrs-UplinkTransformPrecodingPUCCH-r16", "enabled");
    }
    if (spatial_relation_info_to_add_mod_list_size_ext_v1610.is_present()) {
      j.start_array("spatialRelationInfoToAddModListSizeExt-v1610");
      for (const auto& e1 : *spatial_relation_info_to_add_mod_list_size_ext_v1610) {
        e1.to_json(j);
      }
      j.end_array();
    }
    if (spatial_relation_info_to_release_list_size_ext_v1610.is_present()) {
      j.start_array("spatialRelationInfoToReleaseListSizeExt-v1610");
      for (const auto& e1 : *spatial_relation_info_to_release_list_size_ext_v1610) {
        j.write_int(e1);
      }
      j.end_array();
    }
    if (spatial_relation_info_to_add_mod_list_ext_v1610.is_present()) {
      j.start_array("spatialRelationInfoToAddModListExt-v1610");
      for (const auto& e1 : *spatial_relation_info_to_add_mod_list_ext_v1610) {
        e1.to_json(j);
      }
      j.end_array();
    }
    if (spatial_relation_info_to_release_list_ext_v1610.is_present()) {
      j.start_array("spatialRelationInfoToReleaseListExt-v1610");
      for (const auto& e1 : *spatial_relation_info_to_release_list_ext_v1610) {
        j.write_int(e1);
      }
      j.end_array();
    }
    if (res_group_to_add_mod_list_r16.is_present()) {
      j.start_array("resourceGroupToAddModList-r16");
      for (const auto& e1 : *res_group_to_add_mod_list_r16) {
        e1.to_json(j);
      }
      j.end_array();
    }
    if (res_group_to_release_list_r16.is_present()) {
      j.start_array("resourceGroupToReleaseList-r16");
      for (const auto& e1 : *res_group_to_release_list_r16) {
        j.write_int(e1);
      }
      j.end_array();
    }
    if (sps_pucch_an_list_r16.is_present()) {
      j.write_fieldname("sps-PUCCH-AN-List-r16");
      sps_pucch_an_list_r16->to_json(j);
    }
    if (sched_request_res_to_add_mod_list_ext_v1610.is_present()) {
      j.start_array("schedulingRequestResourceToAddModListExt-v1610");
      for (const auto& e1 : *sched_request_res_to_add_mod_list_ext_v1610) {
        e1.to_json(j);
      }
      j.end_array();
    }
    if (format0_r17.is_present()) {
      j.write_fieldname("format0-r17");
      format0_r17->to_json(j);
    }
    if (format2_ext_r17.is_present()) {
      j.write_fieldname("format2Ext-r17");
      format2_ext_r17->to_json(j);
    }
    if (format3_ext_r17.is_present()) {
      j.write_fieldname("format3Ext-r17");
      format3_ext_r17->to_json(j);
    }
    if (format4_ext_r17.is_present()) {
      j.write_fieldname("format4Ext-r17");
      format4_ext_r17->to_json(j);
    }
    if (ul_access_cfg_list_dci_1_2_r17.is_present()) {
      j.write_fieldname("ul-AccessConfigListDCI-1-2-r17");
      ul_access_cfg_list_dci_1_2_r17->to_json(j);
    }
    if (map_pattern_r17_present) {
      j.write_str("mappingPattern-r17", map_pattern_r17.to_string());
    }
    if (pwr_ctrl_set_info_to_add_mod_list_r17.is_present()) {
      j.start_array("powerControlSetInfoToAddModList-r17");
      for (const auto& e1 : *pwr_ctrl_set_info_to_add_mod_list_r17) {
        e1.to_json(j);
      }
      j.end_array();
    }
    if (pwr_ctrl_set_info_to_release_list_r17.is_present()) {
      j.start_array("powerControlSetInfoToReleaseList-r17");
      for (const auto& e1 : *pwr_ctrl_set_info_to_release_list_r17) {
        j.write_int(e1);
      }
      j.end_array();
    }
    if (second_tpc_field_dci_1_1_r17_present) {
      j.write_str("secondTPCFieldDCI-1-1-r17", "enabled");
    }
    if (second_tpc_field_dci_1_2_r17_present) {
      j.write_str("secondTPCFieldDCI-1-2-r17", "enabled");
    }
    if (dl_data_to_ul_ack_r17.is_present()) {
      j.write_fieldname("dl-DataToUL-ACK-r17");
      dl_data_to_ul_ack_r17->to_json(j);
    }
    if (dl_data_to_ul_ack_dci_1_2_r17.is_present()) {
      j.write_fieldname("dl-DataToUL-ACK-DCI-1-2-r17");
      dl_data_to_ul_ack_dci_1_2_r17->to_json(j);
    }
    if (ul_access_cfg_list_dci_1_1_r17.is_present()) {
      j.write_fieldname("ul-AccessConfigListDCI-1-1-r17");
      ul_access_cfg_list_dci_1_1_r17->to_json(j);
    }
    if (sched_request_res_to_add_mod_list_ext_v1700.is_present()) {
      j.start_array("schedulingRequestResourceToAddModListExt-v1700");
      for (const auto& e1 : *sched_request_res_to_add_mod_list_ext_v1700) {
        e1.to_json(j);
      }
      j.end_array();
    }
    if (dmrs_bundling_pucch_cfg_r17.is_present()) {
      j.write_fieldname("dmrs-BundlingPUCCH-Config-r17");
      dmrs_bundling_pucch_cfg_r17->to_json(j);
    }
    if (dl_data_to_ul_ack_v1700.is_present()) {
      j.write_fieldname("dl-DataToUL-ACK-v1700");
      dl_data_to_ul_ack_v1700->to_json(j);
    }
    if (dl_data_to_ul_ack_multicast_dci_format4_1_r17.is_present()) {
      j.write_fieldname("dl-DataToUL-ACK-MulticastDCI-Format4-1-r17");
      dl_data_to_ul_ack_multicast_dci_format4_1_r17->to_json(j);
    }
    if (sps_pucch_an_list_multicast_r17.is_present()) {
      j.write_fieldname("sps-PUCCH-AN-ListMulticast-r17");
      sps_pucch_an_list_multicast_r17->to_json(j);
    }
  }
  j.end_obj();
}

void pucch_cfg_s::subslot_len_for_pucch_r16_c_::destroy_() {}
void pucch_cfg_s::subslot_len_for_pucch_r16_c_::set(types::options e)
{
  destroy_();
  type_ = e;
}
pucch_cfg_s::subslot_len_for_pucch_r16_c_::subslot_len_for_pucch_r16_c_(
    const pucch_cfg_s::subslot_len_for_pucch_r16_c_& other)
{
  type_ = other.type();
  switch (type_) {
    case types::normal_cp_r16:
      c.init(other.c.get<normal_cp_r16_e_>());
      break;
    case types::extended_cp_r16:
      c.init(other.c.get<extended_cp_r16_e_>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "pucch_cfg_s::subslot_len_for_pucch_r16_c_");
  }
}
pucch_cfg_s::subslot_len_for_pucch_r16_c_&
pucch_cfg_s::subslot_len_for_pucch_r16_c_::operator=(const pucch_cfg_s::subslot_len_for_pucch_r16_c_& other)
{
  if (this == &other) {
    return *this;
  }
  set(other.type());
  switch (type_) {
    case types::normal_cp_r16:
      c.set(other.c.get<normal_cp_r16_e_>());
      break;
    case types::extended_cp_r16:
      c.set(other.c.get<extended_cp_r16_e_>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "pucch_cfg_s::subslot_len_for_pucch_r16_c_");
  }

  return *this;
}
pucch_cfg_s::subslot_len_for_pucch_r16_c_::normal_cp_r16_e_&
pucch_cfg_s::subslot_len_for_pucch_r16_c_::set_normal_cp_r16()
{
  set(types::normal_cp_r16);
  return c.get<normal_cp_r16_e_>();
}
pucch_cfg_s::subslot_len_for_pucch_r16_c_::extended_cp_r16_e_&
pucch_cfg_s::subslot_len_for_pucch_r16_c_::set_extended_cp_r16()
{
  set(types::extended_cp_r16);
  return c.get<extended_cp_r16_e_>();
}
void pucch_cfg_s::subslot_len_for_pucch_r16_c_::to_json(json_writer& j) const
{
  j.start_obj();
  switch (type_) {
    case types::normal_cp_r16:
      j.write_str("normalCP-r16", c.get<normal_cp_r16_e_>().to_string());
      break;
    case types::extended_cp_r16:
      j.write_str("extendedCP-r16", c.get<extended_cp_r16_e_>().to_string());
      break;
    default:
      log_invalid_choice_id(type_, "pucch_cfg_s::subslot_len_for_pucch_r16_c_");
  }
  j.end_obj();
}
SRSASN_CODE pucch_cfg_s::subslot_len_for_pucch_r16_c_::pack(bit_ref& bref) const
{
  type_.pack(bref);
  switch (type_) {
    case types::normal_cp_r16:
      HANDLE_CODE(c.get<normal_cp_r16_e_>().pack(bref));
      break;
    case types::extended_cp_r16:
      HANDLE_CODE(c.get<extended_cp_r16_e_>().pack(bref));
      break;
    default:
      log_invalid_choice_id(type_, "pucch_cfg_s::subslot_len_for_pucch_r16_c_");
      return SRSASN_ERROR_ENCODE_FAIL;
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE pucch_cfg_s::subslot_len_for_pucch_r16_c_::unpack(cbit_ref& bref)
{
  types e;
  e.unpack(bref);
  set(e);
  switch (type_) {
    case types::normal_cp_r16:
      HANDLE_CODE(c.get<normal_cp_r16_e_>().unpack(bref));
      break;
    case types::extended_cp_r16:
      HANDLE_CODE(c.get<extended_cp_r16_e_>().unpack(bref));
      break;
    default:
      log_invalid_choice_id(type_, "pucch_cfg_s::subslot_len_for_pucch_r16_c_");
      return SRSASN_ERROR_DECODE_FAIL;
  }
  return SRSASN_SUCCESS;
}

const char* pucch_cfg_s::subslot_len_for_pucch_r16_c_::normal_cp_r16_opts::to_string() const
{
  static const char* names[] = {"n2", "n7"};
  return convert_enum_idx(names, 2, value, "pucch_cfg_s::subslot_len_for_pucch_r16_c_::normal_cp_r16_e_");
}
uint8_t pucch_cfg_s::subslot_len_for_pucch_r16_c_::normal_cp_r16_opts::to_number() const
{
  static const uint8_t numbers[] = {2, 7};
  return map_enum_number(numbers, 2, value, "pucch_cfg_s::subslot_len_for_pucch_r16_c_::normal_cp_r16_e_");
}

const char* pucch_cfg_s::subslot_len_for_pucch_r16_c_::extended_cp_r16_opts::to_string() const
{
  static const char* names[] = {"n2", "n6"};
  return convert_enum_idx(names, 2, value, "pucch_cfg_s::subslot_len_for_pucch_r16_c_::extended_cp_r16_e_");
}
uint8_t pucch_cfg_s::subslot_len_for_pucch_r16_c_::extended_cp_r16_opts::to_number() const
{
  static const uint8_t numbers[] = {2, 6};
  return map_enum_number(numbers, 2, value, "pucch_cfg_s::subslot_len_for_pucch_r16_c_::extended_cp_r16_e_");
}

const char* pucch_cfg_s::subslot_len_for_pucch_r16_c_::types_opts::to_string() const
{
  static const char* names[] = {"normalCP-r16", "extendedCP-r16"};
  return convert_enum_idx(names, 2, value, "pucch_cfg_s::subslot_len_for_pucch_r16_c_::types");
}

const char* pucch_cfg_s::map_pattern_r17_opts::to_string() const
{
  static const char* names[] = {"cyclicMapping", "sequentialMapping"};
  return convert_enum_idx(names, 2, value, "pucch_cfg_s::map_pattern_r17_e_");
}

// PUSCH-PowerControl ::= SEQUENCE
SRSASN_CODE pusch_pwr_ctrl_s::pack(bit_ref& bref) const
{
  HANDLE_CODE(bref.pack(tpc_accumulation_present, 1));
  HANDLE_CODE(bref.pack(msg3_alpha_present, 1));
  HANDLE_CODE(bref.pack(p0_nominal_without_grant_present, 1));
  HANDLE_CODE(bref.pack(p0_alpha_sets.size() > 0, 1));
  HANDLE_CODE(bref.pack(pathloss_ref_rs_to_add_mod_list.size() > 0, 1));
  HANDLE_CODE(bref.pack(pathloss_ref_rs_to_release_list.size() > 0, 1));
  HANDLE_CODE(bref.pack(two_pusch_pc_adjustment_states_present, 1));
  HANDLE_CODE(bref.pack(delta_mcs_present, 1));
  HANDLE_CODE(bref.pack(sri_pusch_map_to_add_mod_list.size() > 0, 1));
  HANDLE_CODE(bref.pack(sri_pusch_map_to_release_list.size() > 0, 1));

  if (msg3_alpha_present) {
    HANDLE_CODE(msg3_alpha.pack(bref));
  }
  if (p0_nominal_without_grant_present) {
    HANDLE_CODE(pack_integer(bref, p0_nominal_without_grant, (int16_t)-202, (int16_t)24));
  }
  if (p0_alpha_sets.size() > 0) {
    HANDLE_CODE(pack_dyn_seq_of(bref, p0_alpha_sets, 1, 30));
  }
  if (pathloss_ref_rs_to_add_mod_list.size() > 0) {
    HANDLE_CODE(pack_dyn_seq_of(bref, pathloss_ref_rs_to_add_mod_list, 1, 4));
  }
  if (pathloss_ref_rs_to_release_list.size() > 0) {
    HANDLE_CODE(pack_dyn_seq_of(bref, pathloss_ref_rs_to_release_list, 1, 4, integer_packer<uint8_t>(0, 3)));
  }
  if (sri_pusch_map_to_add_mod_list.size() > 0) {
    HANDLE_CODE(pack_dyn_seq_of(bref, sri_pusch_map_to_add_mod_list, 1, 16));
  }
  if (sri_pusch_map_to_release_list.size() > 0) {
    HANDLE_CODE(pack_dyn_seq_of(bref, sri_pusch_map_to_release_list, 1, 16, integer_packer<uint8_t>(0, 15)));
  }

  return SRSASN_SUCCESS;
}
SRSASN_CODE pusch_pwr_ctrl_s::unpack(cbit_ref& bref)
{
  HANDLE_CODE(bref.unpack(tpc_accumulation_present, 1));
  HANDLE_CODE(bref.unpack(msg3_alpha_present, 1));
  HANDLE_CODE(bref.unpack(p0_nominal_without_grant_present, 1));
  bool p0_alpha_sets_present;
  HANDLE_CODE(bref.unpack(p0_alpha_sets_present, 1));
  bool pathloss_ref_rs_to_add_mod_list_present;
  HANDLE_CODE(bref.unpack(pathloss_ref_rs_to_add_mod_list_present, 1));
  bool pathloss_ref_rs_to_release_list_present;
  HANDLE_CODE(bref.unpack(pathloss_ref_rs_to_release_list_present, 1));
  HANDLE_CODE(bref.unpack(two_pusch_pc_adjustment_states_present, 1));
  HANDLE_CODE(bref.unpack(delta_mcs_present, 1));
  bool sri_pusch_map_to_add_mod_list_present;
  HANDLE_CODE(bref.unpack(sri_pusch_map_to_add_mod_list_present, 1));
  bool sri_pusch_map_to_release_list_present;
  HANDLE_CODE(bref.unpack(sri_pusch_map_to_release_list_present, 1));

  if (msg3_alpha_present) {
    HANDLE_CODE(msg3_alpha.unpack(bref));
  }
  if (p0_nominal_without_grant_present) {
    HANDLE_CODE(unpack_integer(p0_nominal_without_grant, bref, (int16_t)-202, (int16_t)24));
  }
  if (p0_alpha_sets_present) {
    HANDLE_CODE(unpack_dyn_seq_of(p0_alpha_sets, bref, 1, 30));
  }
  if (pathloss_ref_rs_to_add_mod_list_present) {
    HANDLE_CODE(unpack_dyn_seq_of(pathloss_ref_rs_to_add_mod_list, bref, 1, 4));
  }
  if (pathloss_ref_rs_to_release_list_present) {
    HANDLE_CODE(unpack_dyn_seq_of(pathloss_ref_rs_to_release_list, bref, 1, 4, integer_packer<uint8_t>(0, 3)));
  }
  if (sri_pusch_map_to_add_mod_list_present) {
    HANDLE_CODE(unpack_dyn_seq_of(sri_pusch_map_to_add_mod_list, bref, 1, 16));
  }
  if (sri_pusch_map_to_release_list_present) {
    HANDLE_CODE(unpack_dyn_seq_of(sri_pusch_map_to_release_list, bref, 1, 16, integer_packer<uint8_t>(0, 15)));
  }

  return SRSASN_SUCCESS;
}
void pusch_pwr_ctrl_s::to_json(json_writer& j) const
{
  j.start_obj();
  if (tpc_accumulation_present) {
    j.write_str("tpc-Accumulation", "disabled");
  }
  if (msg3_alpha_present) {
    j.write_str("msg3-Alpha", msg3_alpha.to_string());
  }
  if (p0_nominal_without_grant_present) {
    j.write_int("p0-NominalWithoutGrant", p0_nominal_without_grant);
  }
  if (p0_alpha_sets.size() > 0) {
    j.start_array("p0-AlphaSets");
    for (const auto& e1 : p0_alpha_sets) {
      e1.to_json(j);
    }
    j.end_array();
  }
  if (pathloss_ref_rs_to_add_mod_list.size() > 0) {
    j.start_array("pathlossReferenceRSToAddModList");
    for (const auto& e1 : pathloss_ref_rs_to_add_mod_list) {
      e1.to_json(j);
    }
    j.end_array();
  }
  if (pathloss_ref_rs_to_release_list.size() > 0) {
    j.start_array("pathlossReferenceRSToReleaseList");
    for (const auto& e1 : pathloss_ref_rs_to_release_list) {
      j.write_int(e1);
    }
    j.end_array();
  }
  if (two_pusch_pc_adjustment_states_present) {
    j.write_str("twoPUSCH-PC-AdjustmentStates", "twoStates");
  }
  if (delta_mcs_present) {
    j.write_str("deltaMCS", "enabled");
  }
  if (sri_pusch_map_to_add_mod_list.size() > 0) {
    j.start_array("sri-PUSCH-MappingToAddModList");
    for (const auto& e1 : sri_pusch_map_to_add_mod_list) {
      e1.to_json(j);
    }
    j.end_array();
  }
  if (sri_pusch_map_to_release_list.size() > 0) {
    j.start_array("sri-PUSCH-MappingToReleaseList");
    for (const auto& e1 : sri_pusch_map_to_release_list) {
      j.write_int(e1);
    }
    j.end_array();
  }
  j.end_obj();
}

// PUSCH-PowerControl-v1610 ::= SEQUENCE
SRSASN_CODE pusch_pwr_ctrl_v1610_s::pack(bit_ref& bref) const
{
  bref.pack(ext, 1);
  HANDLE_CODE(bref.pack(pathloss_ref_rs_to_add_mod_list_size_ext_v1610.size() > 0, 1));
  HANDLE_CODE(bref.pack(pathloss_ref_rs_to_release_list_size_ext_v1610.size() > 0, 1));
  HANDLE_CODE(bref.pack(p0_pusch_set_list_r16.size() > 0, 1));
  HANDLE_CODE(bref.pack(olpc_param_set_present, 1));

  if (pathloss_ref_rs_to_add_mod_list_size_ext_v1610.size() > 0) {
    HANDLE_CODE(pack_dyn_seq_of(bref, pathloss_ref_rs_to_add_mod_list_size_ext_v1610, 1, 60));
  }
  if (pathloss_ref_rs_to_release_list_size_ext_v1610.size() > 0) {
    HANDLE_CODE(
        pack_dyn_seq_of(bref, pathloss_ref_rs_to_release_list_size_ext_v1610, 1, 60, integer_packer<uint8_t>(4, 63)));
  }
  if (p0_pusch_set_list_r16.size() > 0) {
    HANDLE_CODE(pack_dyn_seq_of(bref, p0_pusch_set_list_r16, 1, 16));
  }
  if (olpc_param_set_present) {
    HANDLE_CODE(bref.pack(olpc_param_set.olpc_param_set_dci_0_1_r16_present, 1));
    HANDLE_CODE(bref.pack(olpc_param_set.olpc_param_set_dci_0_2_r16_present, 1));
    if (olpc_param_set.olpc_param_set_dci_0_1_r16_present) {
      HANDLE_CODE(pack_integer(bref, olpc_param_set.olpc_param_set_dci_0_1_r16, (uint8_t)1u, (uint8_t)2u));
    }
    if (olpc_param_set.olpc_param_set_dci_0_2_r16_present) {
      HANDLE_CODE(pack_integer(bref, olpc_param_set.olpc_param_set_dci_0_2_r16, (uint8_t)1u, (uint8_t)2u));
    }
  }

  if (ext) {
    ext_groups_packer_guard group_flags;
    group_flags[0] |= sri_pusch_map_to_add_mod_list2_r17.is_present();
    group_flags[0] |= sri_pusch_map_to_release_list2_r17.is_present();
    group_flags[0] |= p0_pusch_set_list2_r17.is_present();
    group_flags[0] |= dummy.is_present();
    group_flags.pack(bref);

    if (group_flags[0]) {
      varlength_field_pack_guard varlen_scope(bref, false);

      HANDLE_CODE(bref.pack(sri_pusch_map_to_add_mod_list2_r17.is_present(), 1));
      HANDLE_CODE(bref.pack(sri_pusch_map_to_release_list2_r17.is_present(), 1));
      HANDLE_CODE(bref.pack(p0_pusch_set_list2_r17.is_present(), 1));
      HANDLE_CODE(bref.pack(dummy.is_present(), 1));
      if (sri_pusch_map_to_add_mod_list2_r17.is_present()) {
        HANDLE_CODE(pack_dyn_seq_of(bref, *sri_pusch_map_to_add_mod_list2_r17, 1, 16));
      }
      if (sri_pusch_map_to_release_list2_r17.is_present()) {
        HANDLE_CODE(pack_dyn_seq_of(bref, *sri_pusch_map_to_release_list2_r17, 1, 16, integer_packer<uint8_t>(0, 15)));
      }
      if (p0_pusch_set_list2_r17.is_present()) {
        HANDLE_CODE(pack_dyn_seq_of(bref, *p0_pusch_set_list2_r17, 1, 16));
      }
      if (dummy.is_present()) {
        HANDLE_CODE(pack_dyn_seq_of(bref, *dummy, 1, 64));
      }
    }
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE pusch_pwr_ctrl_v1610_s::unpack(cbit_ref& bref)
{
  bref.unpack(ext, 1);
  bool pathloss_ref_rs_to_add_mod_list_size_ext_v1610_present;
  HANDLE_CODE(bref.unpack(pathloss_ref_rs_to_add_mod_list_size_ext_v1610_present, 1));
  bool pathloss_ref_rs_to_release_list_size_ext_v1610_present;
  HANDLE_CODE(bref.unpack(pathloss_ref_rs_to_release_list_size_ext_v1610_present, 1));
  bool p0_pusch_set_list_r16_present;
  HANDLE_CODE(bref.unpack(p0_pusch_set_list_r16_present, 1));
  HANDLE_CODE(bref.unpack(olpc_param_set_present, 1));

  if (pathloss_ref_rs_to_add_mod_list_size_ext_v1610_present) {
    HANDLE_CODE(unpack_dyn_seq_of(pathloss_ref_rs_to_add_mod_list_size_ext_v1610, bref, 1, 60));
  }
  if (pathloss_ref_rs_to_release_list_size_ext_v1610_present) {
    HANDLE_CODE(
        unpack_dyn_seq_of(pathloss_ref_rs_to_release_list_size_ext_v1610, bref, 1, 60, integer_packer<uint8_t>(4, 63)));
  }
  if (p0_pusch_set_list_r16_present) {
    HANDLE_CODE(unpack_dyn_seq_of(p0_pusch_set_list_r16, bref, 1, 16));
  }
  if (olpc_param_set_present) {
    HANDLE_CODE(bref.unpack(olpc_param_set.olpc_param_set_dci_0_1_r16_present, 1));
    HANDLE_CODE(bref.unpack(olpc_param_set.olpc_param_set_dci_0_2_r16_present, 1));
    if (olpc_param_set.olpc_param_set_dci_0_1_r16_present) {
      HANDLE_CODE(unpack_integer(olpc_param_set.olpc_param_set_dci_0_1_r16, bref, (uint8_t)1u, (uint8_t)2u));
    }
    if (olpc_param_set.olpc_param_set_dci_0_2_r16_present) {
      HANDLE_CODE(unpack_integer(olpc_param_set.olpc_param_set_dci_0_2_r16, bref, (uint8_t)1u, (uint8_t)2u));
    }
  }

  if (ext) {
    ext_groups_unpacker_guard group_flags(1);
    group_flags.unpack(bref);

    if (group_flags[0]) {
      varlength_field_unpack_guard varlen_scope(bref, false);

      unpack_presence_flag(sri_pusch_map_to_add_mod_list2_r17, bref);
      unpack_presence_flag(sri_pusch_map_to_release_list2_r17, bref);
      unpack_presence_flag(p0_pusch_set_list2_r17, bref);
      unpack_presence_flag(dummy, bref);
      if (sri_pusch_map_to_add_mod_list2_r17.is_present()) {
        HANDLE_CODE(unpack_dyn_seq_of(*sri_pusch_map_to_add_mod_list2_r17, bref, 1, 16));
      }
      if (sri_pusch_map_to_release_list2_r17.is_present()) {
        HANDLE_CODE(
            unpack_dyn_seq_of(*sri_pusch_map_to_release_list2_r17, bref, 1, 16, integer_packer<uint8_t>(0, 15)));
      }
      if (p0_pusch_set_list2_r17.is_present()) {
        HANDLE_CODE(unpack_dyn_seq_of(*p0_pusch_set_list2_r17, bref, 1, 16));
      }
      if (dummy.is_present()) {
        HANDLE_CODE(unpack_dyn_seq_of(*dummy, bref, 1, 64));
      }
    }
  }
  return SRSASN_SUCCESS;
}
void pusch_pwr_ctrl_v1610_s::to_json(json_writer& j) const
{
  j.start_obj();
  if (pathloss_ref_rs_to_add_mod_list_size_ext_v1610.size() > 0) {
    j.start_array("pathlossReferenceRSToAddModListSizeExt-v1610");
    for (const auto& e1 : pathloss_ref_rs_to_add_mod_list_size_ext_v1610) {
      e1.to_json(j);
    }
    j.end_array();
  }
  if (pathloss_ref_rs_to_release_list_size_ext_v1610.size() > 0) {
    j.start_array("pathlossReferenceRSToReleaseListSizeExt-v1610");
    for (const auto& e1 : pathloss_ref_rs_to_release_list_size_ext_v1610) {
      j.write_int(e1);
    }
    j.end_array();
  }
  if (p0_pusch_set_list_r16.size() > 0) {
    j.start_array("p0-PUSCH-SetList-r16");
    for (const auto& e1 : p0_pusch_set_list_r16) {
      e1.to_json(j);
    }
    j.end_array();
  }
  if (olpc_param_set_present) {
    j.write_fieldname("olpc-ParameterSet");
    j.start_obj();
    if (olpc_param_set.olpc_param_set_dci_0_1_r16_present) {
      j.write_int("olpc-ParameterSetDCI-0-1-r16", olpc_param_set.olpc_param_set_dci_0_1_r16);
    }
    if (olpc_param_set.olpc_param_set_dci_0_2_r16_present) {
      j.write_int("olpc-ParameterSetDCI-0-2-r16", olpc_param_set.olpc_param_set_dci_0_2_r16);
    }
    j.end_obj();
  }
  if (ext) {
    if (sri_pusch_map_to_add_mod_list2_r17.is_present()) {
      j.start_array("sri-PUSCH-MappingToAddModList2-r17");
      for (const auto& e1 : *sri_pusch_map_to_add_mod_list2_r17) {
        e1.to_json(j);
      }
      j.end_array();
    }
    if (sri_pusch_map_to_release_list2_r17.is_present()) {
      j.start_array("sri-PUSCH-MappingToReleaseList2-r17");
      for (const auto& e1 : *sri_pusch_map_to_release_list2_r17) {
        j.write_int(e1);
      }
      j.end_array();
    }
    if (p0_pusch_set_list2_r17.is_present()) {
      j.start_array("p0-PUSCH-SetList2-r17");
      for (const auto& e1 : *p0_pusch_set_list2_r17) {
        e1.to_json(j);
      }
      j.end_array();
    }
    if (dummy.is_present()) {
      j.start_array("dummy");
      for (const auto& e1 : *dummy) {
        e1.to_json(j);
      }
      j.end_array();
    }
  }
  j.end_obj();
}

// SRS-PosResourceSet-r16 ::= SEQUENCE
SRSASN_CODE srs_pos_res_set_r16_s::pack(bit_ref& bref) const
{
  bref.pack(ext, 1);
  HANDLE_CODE(bref.pack(srs_pos_res_id_list_r16.size() > 0, 1));
  HANDLE_CODE(bref.pack(alpha_r16_present, 1));
  HANDLE_CODE(bref.pack(p0_r16_present, 1));
  HANDLE_CODE(bref.pack(pathloss_ref_rs_pos_r16_present, 1));

  HANDLE_CODE(pack_integer(bref, srs_pos_res_set_id_r16, (uint8_t)0u, (uint8_t)15u));
  if (srs_pos_res_id_list_r16.size() > 0) {
    HANDLE_CODE(pack_dyn_seq_of(bref, srs_pos_res_id_list_r16, 1, 16, integer_packer<uint8_t>(0, 63)));
  }
  HANDLE_CODE(res_type_r16.pack(bref));
  if (alpha_r16_present) {
    HANDLE_CODE(alpha_r16.pack(bref));
  }
  if (p0_r16_present) {
    HANDLE_CODE(pack_integer(bref, p0_r16, (int16_t)-202, (int16_t)24));
  }
  if (pathloss_ref_rs_pos_r16_present) {
    HANDLE_CODE(pathloss_ref_rs_pos_r16.pack(bref));
  }

  return SRSASN_SUCCESS;
}
SRSASN_CODE srs_pos_res_set_r16_s::unpack(cbit_ref& bref)
{
  bref.unpack(ext, 1);
  bool srs_pos_res_id_list_r16_present;
  HANDLE_CODE(bref.unpack(srs_pos_res_id_list_r16_present, 1));
  HANDLE_CODE(bref.unpack(alpha_r16_present, 1));
  HANDLE_CODE(bref.unpack(p0_r16_present, 1));
  HANDLE_CODE(bref.unpack(pathloss_ref_rs_pos_r16_present, 1));

  HANDLE_CODE(unpack_integer(srs_pos_res_set_id_r16, bref, (uint8_t)0u, (uint8_t)15u));
  if (srs_pos_res_id_list_r16_present) {
    HANDLE_CODE(unpack_dyn_seq_of(srs_pos_res_id_list_r16, bref, 1, 16, integer_packer<uint8_t>(0, 63)));
  }
  HANDLE_CODE(res_type_r16.unpack(bref));
  if (alpha_r16_present) {
    HANDLE_CODE(alpha_r16.unpack(bref));
  }
  if (p0_r16_present) {
    HANDLE_CODE(unpack_integer(p0_r16, bref, (int16_t)-202, (int16_t)24));
  }
  if (pathloss_ref_rs_pos_r16_present) {
    HANDLE_CODE(pathloss_ref_rs_pos_r16.unpack(bref));
  }

  return SRSASN_SUCCESS;
}
void srs_pos_res_set_r16_s::to_json(json_writer& j) const
{
  j.start_obj();
  j.write_int("srs-PosResourceSetId-r16", srs_pos_res_set_id_r16);
  if (srs_pos_res_id_list_r16.size() > 0) {
    j.start_array("srs-PosResourceIdList-r16");
    for (const auto& e1 : srs_pos_res_id_list_r16) {
      j.write_int(e1);
    }
    j.end_array();
  }
  j.write_fieldname("resourceType-r16");
  res_type_r16.to_json(j);
  if (alpha_r16_present) {
    j.write_str("alpha-r16", alpha_r16.to_string());
  }
  if (p0_r16_present) {
    j.write_int("p0-r16", p0_r16);
  }
  if (pathloss_ref_rs_pos_r16_present) {
    j.write_fieldname("pathlossReferenceRS-Pos-r16");
    pathloss_ref_rs_pos_r16.to_json(j);
  }
  j.end_obj();
}

void srs_pos_res_set_r16_s::res_type_r16_c_::destroy_()
{
  switch (type_) {
    case types::aperiodic_r16:
      c.destroy<aperiodic_r16_s_>();
      break;
    case types::semi_persistent_r16:
      c.destroy<semi_persistent_r16_s_>();
      break;
    case types::periodic_r16:
      c.destroy<periodic_r16_s_>();
      break;
    default:
      break;
  }
}
void srs_pos_res_set_r16_s::res_type_r16_c_::set(types::options e)
{
  destroy_();
  type_ = e;
  switch (type_) {
    case types::aperiodic_r16:
      c.init<aperiodic_r16_s_>();
      break;
    case types::semi_persistent_r16:
      c.init<semi_persistent_r16_s_>();
      break;
    case types::periodic_r16:
      c.init<periodic_r16_s_>();
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "srs_pos_res_set_r16_s::res_type_r16_c_");
  }
}
srs_pos_res_set_r16_s::res_type_r16_c_::res_type_r16_c_(const srs_pos_res_set_r16_s::res_type_r16_c_& other)
{
  type_ = other.type();
  switch (type_) {
    case types::aperiodic_r16:
      c.init(other.c.get<aperiodic_r16_s_>());
      break;
    case types::semi_persistent_r16:
      c.init(other.c.get<semi_persistent_r16_s_>());
      break;
    case types::periodic_r16:
      c.init(other.c.get<periodic_r16_s_>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "srs_pos_res_set_r16_s::res_type_r16_c_");
  }
}
srs_pos_res_set_r16_s::res_type_r16_c_&
srs_pos_res_set_r16_s::res_type_r16_c_::operator=(const srs_pos_res_set_r16_s::res_type_r16_c_& other)
{
  if (this == &other) {
    return *this;
  }
  set(other.type());
  switch (type_) {
    case types::aperiodic_r16:
      c.set(other.c.get<aperiodic_r16_s_>());
      break;
    case types::semi_persistent_r16:
      c.set(other.c.get<semi_persistent_r16_s_>());
      break;
    case types::periodic_r16:
      c.set(other.c.get<periodic_r16_s_>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "srs_pos_res_set_r16_s::res_type_r16_c_");
  }

  return *this;
}
srs_pos_res_set_r16_s::res_type_r16_c_::aperiodic_r16_s_& srs_pos_res_set_r16_s::res_type_r16_c_::set_aperiodic_r16()
{
  set(types::aperiodic_r16);
  return c.get<aperiodic_r16_s_>();
}
srs_pos_res_set_r16_s::res_type_r16_c_::semi_persistent_r16_s_&
srs_pos_res_set_r16_s::res_type_r16_c_::set_semi_persistent_r16()
{
  set(types::semi_persistent_r16);
  return c.get<semi_persistent_r16_s_>();
}
srs_pos_res_set_r16_s::res_type_r16_c_::periodic_r16_s_& srs_pos_res_set_r16_s::res_type_r16_c_::set_periodic_r16()
{
  set(types::periodic_r16);
  return c.get<periodic_r16_s_>();
}
void srs_pos_res_set_r16_s::res_type_r16_c_::to_json(json_writer& j) const
{
  j.start_obj();
  switch (type_) {
    case types::aperiodic_r16:
      j.write_fieldname("aperiodic-r16");
      j.start_obj();
      if (c.get<aperiodic_r16_s_>().aperiodic_srs_res_trigger_list_r16.size() > 0) {
        j.start_array("aperiodicSRS-ResourceTriggerList-r16");
        for (const auto& e1 : c.get<aperiodic_r16_s_>().aperiodic_srs_res_trigger_list_r16) {
          j.write_int(e1);
        }
        j.end_array();
      }
      j.end_obj();
      break;
    case types::semi_persistent_r16:
      j.write_fieldname("semi-persistent-r16");
      j.start_obj();
      j.end_obj();
      break;
    case types::periodic_r16:
      j.write_fieldname("periodic-r16");
      j.start_obj();
      j.end_obj();
      break;
    default:
      log_invalid_choice_id(type_, "srs_pos_res_set_r16_s::res_type_r16_c_");
  }
  j.end_obj();
}
SRSASN_CODE srs_pos_res_set_r16_s::res_type_r16_c_::pack(bit_ref& bref) const
{
  type_.pack(bref);
  switch (type_) {
    case types::aperiodic_r16:
      bref.pack(c.get<aperiodic_r16_s_>().ext, 1);
      HANDLE_CODE(bref.pack(c.get<aperiodic_r16_s_>().aperiodic_srs_res_trigger_list_r16.size() > 0, 1));
      if (c.get<aperiodic_r16_s_>().aperiodic_srs_res_trigger_list_r16.size() > 0) {
        HANDLE_CODE(pack_dyn_seq_of(
            bref, c.get<aperiodic_r16_s_>().aperiodic_srs_res_trigger_list_r16, 1, 3, integer_packer<uint8_t>(1, 3)));
      }
      break;
    case types::semi_persistent_r16:
      bref.pack(c.get<semi_persistent_r16_s_>().ext, 1);
      break;
    case types::periodic_r16:
      bref.pack(c.get<periodic_r16_s_>().ext, 1);
      break;
    default:
      log_invalid_choice_id(type_, "srs_pos_res_set_r16_s::res_type_r16_c_");
      return SRSASN_ERROR_ENCODE_FAIL;
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE srs_pos_res_set_r16_s::res_type_r16_c_::unpack(cbit_ref& bref)
{
  types e;
  e.unpack(bref);
  set(e);
  switch (type_) {
    case types::aperiodic_r16:
      bref.unpack(c.get<aperiodic_r16_s_>().ext, 1);
      bool aperiodic_srs_res_trigger_list_r16_present;
      HANDLE_CODE(bref.unpack(aperiodic_srs_res_trigger_list_r16_present, 1));
      if (aperiodic_srs_res_trigger_list_r16_present) {
        HANDLE_CODE(unpack_dyn_seq_of(
            c.get<aperiodic_r16_s_>().aperiodic_srs_res_trigger_list_r16, bref, 1, 3, integer_packer<uint8_t>(1, 3)));
      }
      break;
    case types::semi_persistent_r16:
      bref.unpack(c.get<semi_persistent_r16_s_>().ext, 1);
      break;
    case types::periodic_r16:
      bref.unpack(c.get<periodic_r16_s_>().ext, 1);
      break;
    default:
      log_invalid_choice_id(type_, "srs_pos_res_set_r16_s::res_type_r16_c_");
      return SRSASN_ERROR_DECODE_FAIL;
  }
  return SRSASN_SUCCESS;
}

const char* srs_pos_res_set_r16_s::res_type_r16_c_::types_opts::to_string() const
{
  static const char* names[] = {"aperiodic-r16", "semi-persistent-r16", "periodic-r16"};
  return convert_enum_idx(names, 3, value, "srs_pos_res_set_r16_s::res_type_r16_c_::types");
}

void srs_pos_res_set_r16_s::pathloss_ref_rs_pos_r16_c_::destroy_()
{
  switch (type_) {
    case types::ssb_ncell_r16:
      c.destroy<ssb_info_ncell_r16_s>();
      break;
    case types::dl_prs_r16:
      c.destroy<dl_prs_info_r16_s>();
      break;
    default:
      break;
  }
}
void srs_pos_res_set_r16_s::pathloss_ref_rs_pos_r16_c_::set(types::options e)
{
  destroy_();
  type_ = e;
  switch (type_) {
    case types::ssb_idx_serving_r16:
      break;
    case types::ssb_ncell_r16:
      c.init<ssb_info_ncell_r16_s>();
      break;
    case types::dl_prs_r16:
      c.init<dl_prs_info_r16_s>();
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "srs_pos_res_set_r16_s::pathloss_ref_rs_pos_r16_c_");
  }
}
srs_pos_res_set_r16_s::pathloss_ref_rs_pos_r16_c_::pathloss_ref_rs_pos_r16_c_(
    const srs_pos_res_set_r16_s::pathloss_ref_rs_pos_r16_c_& other)
{
  type_ = other.type();
  switch (type_) {
    case types::ssb_idx_serving_r16:
      c.init(other.c.get<uint8_t>());
      break;
    case types::ssb_ncell_r16:
      c.init(other.c.get<ssb_info_ncell_r16_s>());
      break;
    case types::dl_prs_r16:
      c.init(other.c.get<dl_prs_info_r16_s>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "srs_pos_res_set_r16_s::pathloss_ref_rs_pos_r16_c_");
  }
}
srs_pos_res_set_r16_s::pathloss_ref_rs_pos_r16_c_& srs_pos_res_set_r16_s::pathloss_ref_rs_pos_r16_c_::operator=(
    const srs_pos_res_set_r16_s::pathloss_ref_rs_pos_r16_c_& other)
{
  if (this == &other) {
    return *this;
  }
  set(other.type());
  switch (type_) {
    case types::ssb_idx_serving_r16:
      c.set(other.c.get<uint8_t>());
      break;
    case types::ssb_ncell_r16:
      c.set(other.c.get<ssb_info_ncell_r16_s>());
      break;
    case types::dl_prs_r16:
      c.set(other.c.get<dl_prs_info_r16_s>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "srs_pos_res_set_r16_s::pathloss_ref_rs_pos_r16_c_");
  }

  return *this;
}
uint8_t& srs_pos_res_set_r16_s::pathloss_ref_rs_pos_r16_c_::set_ssb_idx_serving_r16()
{
  set(types::ssb_idx_serving_r16);
  return c.get<uint8_t>();
}
ssb_info_ncell_r16_s& srs_pos_res_set_r16_s::pathloss_ref_rs_pos_r16_c_::set_ssb_ncell_r16()
{
  set(types::ssb_ncell_r16);
  return c.get<ssb_info_ncell_r16_s>();
}
dl_prs_info_r16_s& srs_pos_res_set_r16_s::pathloss_ref_rs_pos_r16_c_::set_dl_prs_r16()
{
  set(types::dl_prs_r16);
  return c.get<dl_prs_info_r16_s>();
}
void srs_pos_res_set_r16_s::pathloss_ref_rs_pos_r16_c_::to_json(json_writer& j) const
{
  j.start_obj();
  switch (type_) {
    case types::ssb_idx_serving_r16:
      j.write_int("ssb-IndexServing-r16", c.get<uint8_t>());
      break;
    case types::ssb_ncell_r16:
      j.write_fieldname("ssb-Ncell-r16");
      c.get<ssb_info_ncell_r16_s>().to_json(j);
      break;
    case types::dl_prs_r16:
      j.write_fieldname("dl-PRS-r16");
      c.get<dl_prs_info_r16_s>().to_json(j);
      break;
    default:
      log_invalid_choice_id(type_, "srs_pos_res_set_r16_s::pathloss_ref_rs_pos_r16_c_");
  }
  j.end_obj();
}
SRSASN_CODE srs_pos_res_set_r16_s::pathloss_ref_rs_pos_r16_c_::pack(bit_ref& bref) const
{
  type_.pack(bref);
  switch (type_) {
    case types::ssb_idx_serving_r16:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)63u));
      break;
    case types::ssb_ncell_r16:
      HANDLE_CODE(c.get<ssb_info_ncell_r16_s>().pack(bref));
      break;
    case types::dl_prs_r16:
      HANDLE_CODE(c.get<dl_prs_info_r16_s>().pack(bref));
      break;
    default:
      log_invalid_choice_id(type_, "srs_pos_res_set_r16_s::pathloss_ref_rs_pos_r16_c_");
      return SRSASN_ERROR_ENCODE_FAIL;
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE srs_pos_res_set_r16_s::pathloss_ref_rs_pos_r16_c_::unpack(cbit_ref& bref)
{
  types e;
  e.unpack(bref);
  set(e);
  switch (type_) {
    case types::ssb_idx_serving_r16:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)63u));
      break;
    case types::ssb_ncell_r16:
      HANDLE_CODE(c.get<ssb_info_ncell_r16_s>().unpack(bref));
      break;
    case types::dl_prs_r16:
      HANDLE_CODE(c.get<dl_prs_info_r16_s>().unpack(bref));
      break;
    default:
      log_invalid_choice_id(type_, "srs_pos_res_set_r16_s::pathloss_ref_rs_pos_r16_c_");
      return SRSASN_ERROR_DECODE_FAIL;
  }
  return SRSASN_SUCCESS;
}

const char* srs_pos_res_set_r16_s::pathloss_ref_rs_pos_r16_c_::types_opts::to_string() const
{
  static const char* names[] = {"ssb-IndexServing-r16", "ssb-Ncell-r16", "dl-PRS-r16"};
  return convert_enum_idx(names, 3, value, "srs_pos_res_set_r16_s::pathloss_ref_rs_pos_r16_c_::types");
}

// SRS-ResourceSet ::= SEQUENCE
SRSASN_CODE srs_res_set_s::pack(bit_ref& bref) const
{
  bref.pack(ext, 1);
  HANDLE_CODE(bref.pack(srs_res_id_list.size() > 0, 1));
  HANDLE_CODE(bref.pack(alpha_present, 1));
  HANDLE_CODE(bref.pack(p0_present, 1));
  HANDLE_CODE(bref.pack(pathloss_ref_rs_present, 1));
  HANDLE_CODE(bref.pack(srs_pwr_ctrl_adjustment_states_present, 1));

  HANDLE_CODE(pack_integer(bref, srs_res_set_id, (uint8_t)0u, (uint8_t)15u));
  if (srs_res_id_list.size() > 0) {
    HANDLE_CODE(pack_dyn_seq_of(bref, srs_res_id_list, 1, 16, integer_packer<uint8_t>(0, 63)));
  }
  HANDLE_CODE(res_type.pack(bref));
  HANDLE_CODE(usage.pack(bref));
  if (alpha_present) {
    HANDLE_CODE(alpha.pack(bref));
  }
  if (p0_present) {
    HANDLE_CODE(pack_integer(bref, p0, (int16_t)-202, (int16_t)24));
  }
  if (pathloss_ref_rs_present) {
    HANDLE_CODE(pathloss_ref_rs.pack(bref));
  }
  if (srs_pwr_ctrl_adjustment_states_present) {
    HANDLE_CODE(srs_pwr_ctrl_adjustment_states.pack(bref));
  }

  if (ext) {
    ext_groups_packer_guard group_flags;
    group_flags[0] |= pathloss_ref_rs_list_r16.is_present();
    group_flags[1] |= usage_pdc_r17_present;
    group_flags[1] |= available_slot_offset_list_r17.is_present();
    group_flags[1] |= follow_unified_tci_state_srs_r17_present;
    group_flags.pack(bref);

    if (group_flags[0]) {
      varlength_field_pack_guard varlen_scope(bref, false);

      HANDLE_CODE(bref.pack(pathloss_ref_rs_list_r16.is_present(), 1));
      if (pathloss_ref_rs_list_r16.is_present()) {
        HANDLE_CODE(pathloss_ref_rs_list_r16->pack(bref));
      }
    }
    if (group_flags[1]) {
      varlength_field_pack_guard varlen_scope(bref, false);

      HANDLE_CODE(bref.pack(usage_pdc_r17_present, 1));
      HANDLE_CODE(bref.pack(available_slot_offset_list_r17.is_present(), 1));
      HANDLE_CODE(bref.pack(follow_unified_tci_state_srs_r17_present, 1));
      if (available_slot_offset_list_r17.is_present()) {
        HANDLE_CODE(pack_dyn_seq_of(bref, *available_slot_offset_list_r17, 1, 4, integer_packer<uint8_t>(0, 7)));
      }
    }
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE srs_res_set_s::unpack(cbit_ref& bref)
{
  bref.unpack(ext, 1);
  bool srs_res_id_list_present;
  HANDLE_CODE(bref.unpack(srs_res_id_list_present, 1));
  HANDLE_CODE(bref.unpack(alpha_present, 1));
  HANDLE_CODE(bref.unpack(p0_present, 1));
  HANDLE_CODE(bref.unpack(pathloss_ref_rs_present, 1));
  HANDLE_CODE(bref.unpack(srs_pwr_ctrl_adjustment_states_present, 1));

  HANDLE_CODE(unpack_integer(srs_res_set_id, bref, (uint8_t)0u, (uint8_t)15u));
  if (srs_res_id_list_present) {
    HANDLE_CODE(unpack_dyn_seq_of(srs_res_id_list, bref, 1, 16, integer_packer<uint8_t>(0, 63)));
  }
  HANDLE_CODE(res_type.unpack(bref));
  HANDLE_CODE(usage.unpack(bref));
  if (alpha_present) {
    HANDLE_CODE(alpha.unpack(bref));
  }
  if (p0_present) {
    HANDLE_CODE(unpack_integer(p0, bref, (int16_t)-202, (int16_t)24));
  }
  if (pathloss_ref_rs_present) {
    HANDLE_CODE(pathloss_ref_rs.unpack(bref));
  }
  if (srs_pwr_ctrl_adjustment_states_present) {
    HANDLE_CODE(srs_pwr_ctrl_adjustment_states.unpack(bref));
  }

  if (ext) {
    ext_groups_unpacker_guard group_flags(2);
    group_flags.unpack(bref);

    if (group_flags[0]) {
      varlength_field_unpack_guard varlen_scope(bref, false);

      unpack_presence_flag(pathloss_ref_rs_list_r16, bref);
      if (pathloss_ref_rs_list_r16.is_present()) {
        HANDLE_CODE(pathloss_ref_rs_list_r16->unpack(bref));
      }
    }
    if (group_flags[1]) {
      varlength_field_unpack_guard varlen_scope(bref, false);

      HANDLE_CODE(bref.unpack(usage_pdc_r17_present, 1));
      unpack_presence_flag(available_slot_offset_list_r17, bref);
      HANDLE_CODE(bref.unpack(follow_unified_tci_state_srs_r17_present, 1));
      if (available_slot_offset_list_r17.is_present()) {
        HANDLE_CODE(unpack_dyn_seq_of(*available_slot_offset_list_r17, bref, 1, 4, integer_packer<uint8_t>(0, 7)));
      }
    }
  }
  return SRSASN_SUCCESS;
}
void srs_res_set_s::to_json(json_writer& j) const
{
  j.start_obj();
  j.write_int("srs-ResourceSetId", srs_res_set_id);
  if (srs_res_id_list.size() > 0) {
    j.start_array("srs-ResourceIdList");
    for (const auto& e1 : srs_res_id_list) {
      j.write_int(e1);
    }
    j.end_array();
  }
  j.write_fieldname("resourceType");
  res_type.to_json(j);
  j.write_str("usage", usage.to_string());
  if (alpha_present) {
    j.write_str("alpha", alpha.to_string());
  }
  if (p0_present) {
    j.write_int("p0", p0);
  }
  if (pathloss_ref_rs_present) {
    j.write_fieldname("pathlossReferenceRS");
    pathloss_ref_rs.to_json(j);
  }
  if (srs_pwr_ctrl_adjustment_states_present) {
    j.write_str("srs-PowerControlAdjustmentStates", srs_pwr_ctrl_adjustment_states.to_string());
  }
  if (ext) {
    if (pathloss_ref_rs_list_r16.is_present()) {
      j.write_fieldname("pathlossReferenceRSList-r16");
      pathloss_ref_rs_list_r16->to_json(j);
    }
    if (usage_pdc_r17_present) {
      j.write_str("usagePDC-r17", "true");
    }
    if (available_slot_offset_list_r17.is_present()) {
      j.start_array("availableSlotOffsetList-r17");
      for (const auto& e1 : *available_slot_offset_list_r17) {
        j.write_int(e1);
      }
      j.end_array();
    }
    if (follow_unified_tci_state_srs_r17_present) {
      j.write_str("followUnifiedTCI-StateSRS-r17", "enabled");
    }
  }
  j.end_obj();
}

void srs_res_set_s::res_type_c_::destroy_()
{
  switch (type_) {
    case types::aperiodic:
      c.destroy<aperiodic_s_>();
      break;
    case types::semi_persistent:
      c.destroy<semi_persistent_s_>();
      break;
    case types::periodic:
      c.destroy<periodic_s_>();
      break;
    default:
      break;
  }
}
void srs_res_set_s::res_type_c_::set(types::options e)
{
  destroy_();
  type_ = e;
  switch (type_) {
    case types::aperiodic:
      c.init<aperiodic_s_>();
      break;
    case types::semi_persistent:
      c.init<semi_persistent_s_>();
      break;
    case types::periodic:
      c.init<periodic_s_>();
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "srs_res_set_s::res_type_c_");
  }
}
srs_res_set_s::res_type_c_::res_type_c_(const srs_res_set_s::res_type_c_& other)
{
  type_ = other.type();
  switch (type_) {
    case types::aperiodic:
      c.init(other.c.get<aperiodic_s_>());
      break;
    case types::semi_persistent:
      c.init(other.c.get<semi_persistent_s_>());
      break;
    case types::periodic:
      c.init(other.c.get<periodic_s_>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "srs_res_set_s::res_type_c_");
  }
}
srs_res_set_s::res_type_c_& srs_res_set_s::res_type_c_::operator=(const srs_res_set_s::res_type_c_& other)
{
  if (this == &other) {
    return *this;
  }
  set(other.type());
  switch (type_) {
    case types::aperiodic:
      c.set(other.c.get<aperiodic_s_>());
      break;
    case types::semi_persistent:
      c.set(other.c.get<semi_persistent_s_>());
      break;
    case types::periodic:
      c.set(other.c.get<periodic_s_>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "srs_res_set_s::res_type_c_");
  }

  return *this;
}
srs_res_set_s::res_type_c_::aperiodic_s_& srs_res_set_s::res_type_c_::set_aperiodic()
{
  set(types::aperiodic);
  return c.get<aperiodic_s_>();
}
srs_res_set_s::res_type_c_::semi_persistent_s_& srs_res_set_s::res_type_c_::set_semi_persistent()
{
  set(types::semi_persistent);
  return c.get<semi_persistent_s_>();
}
srs_res_set_s::res_type_c_::periodic_s_& srs_res_set_s::res_type_c_::set_periodic()
{
  set(types::periodic);
  return c.get<periodic_s_>();
}
void srs_res_set_s::res_type_c_::to_json(json_writer& j) const
{
  j.start_obj();
  switch (type_) {
    case types::aperiodic:
      j.write_fieldname("aperiodic");
      c.get<aperiodic_s_>().to_json(j);
      break;
    case types::semi_persistent:
      j.write_fieldname("semi-persistent");
      j.start_obj();
      if (c.get<semi_persistent_s_>().associated_csi_rs_present) {
        j.write_int("associatedCSI-RS", c.get<semi_persistent_s_>().associated_csi_rs);
      }
      j.end_obj();
      break;
    case types::periodic:
      j.write_fieldname("periodic");
      j.start_obj();
      if (c.get<periodic_s_>().associated_csi_rs_present) {
        j.write_int("associatedCSI-RS", c.get<periodic_s_>().associated_csi_rs);
      }
      j.end_obj();
      break;
    default:
      log_invalid_choice_id(type_, "srs_res_set_s::res_type_c_");
  }
  j.end_obj();
}
SRSASN_CODE srs_res_set_s::res_type_c_::pack(bit_ref& bref) const
{
  type_.pack(bref);
  switch (type_) {
    case types::aperiodic:
      HANDLE_CODE(c.get<aperiodic_s_>().pack(bref));
      break;
    case types::semi_persistent:
      bref.pack(c.get<semi_persistent_s_>().ext, 1);
      HANDLE_CODE(bref.pack(c.get<semi_persistent_s_>().associated_csi_rs_present, 1));
      if (c.get<semi_persistent_s_>().associated_csi_rs_present) {
        HANDLE_CODE(pack_integer(bref, c.get<semi_persistent_s_>().associated_csi_rs, (uint8_t)0u, (uint8_t)191u));
      }
      break;
    case types::periodic:
      bref.pack(c.get<periodic_s_>().ext, 1);
      HANDLE_CODE(bref.pack(c.get<periodic_s_>().associated_csi_rs_present, 1));
      if (c.get<periodic_s_>().associated_csi_rs_present) {
        HANDLE_CODE(pack_integer(bref, c.get<periodic_s_>().associated_csi_rs, (uint8_t)0u, (uint8_t)191u));
      }
      break;
    default:
      log_invalid_choice_id(type_, "srs_res_set_s::res_type_c_");
      return SRSASN_ERROR_ENCODE_FAIL;
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE srs_res_set_s::res_type_c_::unpack(cbit_ref& bref)
{
  types e;
  e.unpack(bref);
  set(e);
  switch (type_) {
    case types::aperiodic:
      HANDLE_CODE(c.get<aperiodic_s_>().unpack(bref));
      break;
    case types::semi_persistent:
      bref.unpack(c.get<semi_persistent_s_>().ext, 1);
      HANDLE_CODE(bref.unpack(c.get<semi_persistent_s_>().associated_csi_rs_present, 1));
      if (c.get<semi_persistent_s_>().associated_csi_rs_present) {
        HANDLE_CODE(unpack_integer(c.get<semi_persistent_s_>().associated_csi_rs, bref, (uint8_t)0u, (uint8_t)191u));
      }
      break;
    case types::periodic:
      bref.unpack(c.get<periodic_s_>().ext, 1);
      HANDLE_CODE(bref.unpack(c.get<periodic_s_>().associated_csi_rs_present, 1));
      if (c.get<periodic_s_>().associated_csi_rs_present) {
        HANDLE_CODE(unpack_integer(c.get<periodic_s_>().associated_csi_rs, bref, (uint8_t)0u, (uint8_t)191u));
      }
      break;
    default:
      log_invalid_choice_id(type_, "srs_res_set_s::res_type_c_");
      return SRSASN_ERROR_DECODE_FAIL;
  }
  return SRSASN_SUCCESS;
}

SRSASN_CODE srs_res_set_s::res_type_c_::aperiodic_s_::pack(bit_ref& bref) const
{
  bref.pack(ext, 1);
  HANDLE_CODE(bref.pack(csi_rs_present, 1));
  HANDLE_CODE(bref.pack(slot_offset_present, 1));

  HANDLE_CODE(pack_integer(bref, aperiodic_srs_res_trigger, (uint8_t)1u, (uint8_t)3u));
  if (csi_rs_present) {
    HANDLE_CODE(pack_integer(bref, csi_rs, (uint8_t)0u, (uint8_t)191u));
  }
  if (slot_offset_present) {
    HANDLE_CODE(pack_integer(bref, slot_offset, (uint8_t)1u, (uint8_t)32u));
  }

  if (ext) {
    ext_groups_packer_guard group_flags;
    group_flags[0] |= aperiodic_srs_res_trigger_list.is_present();
    group_flags.pack(bref);

    if (group_flags[0]) {
      varlength_field_pack_guard varlen_scope(bref, false);

      HANDLE_CODE(bref.pack(aperiodic_srs_res_trigger_list.is_present(), 1));
      if (aperiodic_srs_res_trigger_list.is_present()) {
        HANDLE_CODE(pack_dyn_seq_of(bref, *aperiodic_srs_res_trigger_list, 1, 2, integer_packer<uint8_t>(1, 3)));
      }
    }
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE srs_res_set_s::res_type_c_::aperiodic_s_::unpack(cbit_ref& bref)
{
  bref.unpack(ext, 1);
  HANDLE_CODE(bref.unpack(csi_rs_present, 1));
  HANDLE_CODE(bref.unpack(slot_offset_present, 1));

  HANDLE_CODE(unpack_integer(aperiodic_srs_res_trigger, bref, (uint8_t)1u, (uint8_t)3u));
  if (csi_rs_present) {
    HANDLE_CODE(unpack_integer(csi_rs, bref, (uint8_t)0u, (uint8_t)191u));
  }
  if (slot_offset_present) {
    HANDLE_CODE(unpack_integer(slot_offset, bref, (uint8_t)1u, (uint8_t)32u));
  }

  if (ext) {
    ext_groups_unpacker_guard group_flags(1);
    group_flags.unpack(bref);

    if (group_flags[0]) {
      varlength_field_unpack_guard varlen_scope(bref, false);

      unpack_presence_flag(aperiodic_srs_res_trigger_list, bref);
      if (aperiodic_srs_res_trigger_list.is_present()) {
        HANDLE_CODE(unpack_dyn_seq_of(*aperiodic_srs_res_trigger_list, bref, 1, 2, integer_packer<uint8_t>(1, 3)));
      }
    }
  }
  return SRSASN_SUCCESS;
}
void srs_res_set_s::res_type_c_::aperiodic_s_::to_json(json_writer& j) const
{
  j.start_obj();
  j.write_int("aperiodicSRS-ResourceTrigger", aperiodic_srs_res_trigger);
  if (csi_rs_present) {
    j.write_int("csi-RS", csi_rs);
  }
  if (slot_offset_present) {
    j.write_int("slotOffset", slot_offset);
  }
  if (ext) {
    if (aperiodic_srs_res_trigger_list.is_present()) {
      j.start_array("aperiodicSRS-ResourceTriggerList");
      for (const auto& e1 : *aperiodic_srs_res_trigger_list) {
        j.write_int(e1);
      }
      j.end_array();
    }
  }
  j.end_obj();
}

const char* srs_res_set_s::res_type_c_::types_opts::to_string() const
{
  static const char* names[] = {"aperiodic", "semi-persistent", "periodic"};
  return convert_enum_idx(names, 3, value, "srs_res_set_s::res_type_c_::types");
}

const char* srs_res_set_s::usage_opts::to_string() const
{
  static const char* names[] = {"beamManagement", "codebook", "nonCodebook", "antennaSwitching"};
  return convert_enum_idx(names, 4, value, "srs_res_set_s::usage_e_");
}

const char* srs_res_set_s::srs_pwr_ctrl_adjustment_states_opts::to_string() const
{
  static const char* names[] = {"sameAsFci2", "separateClosedLoop"};
  return convert_enum_idx(names, 2, value, "srs_res_set_s::srs_pwr_ctrl_adjustment_states_e_");
}
uint8_t srs_res_set_s::srs_pwr_ctrl_adjustment_states_opts::to_number() const
{
  static const uint8_t numbers[] = {2};
  return map_enum_number(numbers, 1, value, "srs_res_set_s::srs_pwr_ctrl_adjustment_states_e_");
}

// BeamFailureRecoveryConfig ::= SEQUENCE
SRSASN_CODE beam_fail_recovery_cfg_s::pack(bit_ref& bref) const
{
  bref.pack(ext, 1);
  HANDLE_CODE(bref.pack(root_seq_idx_bfr_present, 1));
  HANDLE_CODE(bref.pack(rach_cfg_bfr_present, 1));
  HANDLE_CODE(bref.pack(rsrp_thres_ssb_present, 1));
  HANDLE_CODE(bref.pack(candidate_beam_rs_list.size() > 0, 1));
  HANDLE_CODE(bref.pack(ssb_per_rach_occasion_present, 1));
  HANDLE_CODE(bref.pack(ra_ssb_occasion_mask_idx_present, 1));
  HANDLE_CODE(bref.pack(recovery_search_space_id_present, 1));
  HANDLE_CODE(bref.pack(ra_prioritization_present, 1));
  HANDLE_CODE(bref.pack(beam_fail_recovery_timer_present, 1));

  if (root_seq_idx_bfr_present) {
    HANDLE_CODE(pack_integer(bref, root_seq_idx_bfr, (uint8_t)0u, (uint8_t)137u));
  }
  if (rach_cfg_bfr_present) {
    HANDLE_CODE(rach_cfg_bfr.pack(bref));
  }
  if (rsrp_thres_ssb_present) {
    HANDLE_CODE(pack_integer(bref, rsrp_thres_ssb, (uint8_t)0u, (uint8_t)127u));
  }
  if (candidate_beam_rs_list.size() > 0) {
    HANDLE_CODE(pack_dyn_seq_of(bref, candidate_beam_rs_list, 1, 16));
  }
  if (ssb_per_rach_occasion_present) {
    HANDLE_CODE(ssb_per_rach_occasion.pack(bref));
  }
  if (ra_ssb_occasion_mask_idx_present) {
    HANDLE_CODE(pack_integer(bref, ra_ssb_occasion_mask_idx, (uint8_t)0u, (uint8_t)15u));
  }
  if (recovery_search_space_id_present) {
    HANDLE_CODE(pack_integer(bref, recovery_search_space_id, (uint8_t)0u, (uint8_t)39u));
  }
  if (ra_prioritization_present) {
    HANDLE_CODE(ra_prioritization.pack(bref));
  }
  if (beam_fail_recovery_timer_present) {
    HANDLE_CODE(beam_fail_recovery_timer.pack(bref));
  }

  if (ext) {
    ext_groups_packer_guard group_flags;
    group_flags[0] |= msg1_subcarrier_spacing_present;
    group_flags[1] |= ra_prioritization_two_step_r16.is_present();
    group_flags[1] |= candidate_beam_rs_list_ext_v1610.is_present();
    group_flags[2] |= sp_cell_bfr_cbra_r16_present;
    group_flags.pack(bref);

    if (group_flags[0]) {
      varlength_field_pack_guard varlen_scope(bref, false);

      HANDLE_CODE(bref.pack(msg1_subcarrier_spacing_present, 1));
      if (msg1_subcarrier_spacing_present) {
        HANDLE_CODE(msg1_subcarrier_spacing.pack(bref));
      }
    }
    if (group_flags[1]) {
      varlength_field_pack_guard varlen_scope(bref, false);

      HANDLE_CODE(bref.pack(ra_prioritization_two_step_r16.is_present(), 1));
      HANDLE_CODE(bref.pack(candidate_beam_rs_list_ext_v1610.is_present(), 1));
      if (ra_prioritization_two_step_r16.is_present()) {
        HANDLE_CODE(ra_prioritization_two_step_r16->pack(bref));
      }
      if (candidate_beam_rs_list_ext_v1610.is_present()) {
        HANDLE_CODE(candidate_beam_rs_list_ext_v1610->pack(bref));
      }
    }
    if (group_flags[2]) {
      varlength_field_pack_guard varlen_scope(bref, false);

      HANDLE_CODE(bref.pack(sp_cell_bfr_cbra_r16_present, 1));
    }
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE beam_fail_recovery_cfg_s::unpack(cbit_ref& bref)
{
  bref.unpack(ext, 1);
  HANDLE_CODE(bref.unpack(root_seq_idx_bfr_present, 1));
  HANDLE_CODE(bref.unpack(rach_cfg_bfr_present, 1));
  HANDLE_CODE(bref.unpack(rsrp_thres_ssb_present, 1));
  bool candidate_beam_rs_list_present;
  HANDLE_CODE(bref.unpack(candidate_beam_rs_list_present, 1));
  HANDLE_CODE(bref.unpack(ssb_per_rach_occasion_present, 1));
  HANDLE_CODE(bref.unpack(ra_ssb_occasion_mask_idx_present, 1));
  HANDLE_CODE(bref.unpack(recovery_search_space_id_present, 1));
  HANDLE_CODE(bref.unpack(ra_prioritization_present, 1));
  HANDLE_CODE(bref.unpack(beam_fail_recovery_timer_present, 1));

  if (root_seq_idx_bfr_present) {
    HANDLE_CODE(unpack_integer(root_seq_idx_bfr, bref, (uint8_t)0u, (uint8_t)137u));
  }
  if (rach_cfg_bfr_present) {
    HANDLE_CODE(rach_cfg_bfr.unpack(bref));
  }
  if (rsrp_thres_ssb_present) {
    HANDLE_CODE(unpack_integer(rsrp_thres_ssb, bref, (uint8_t)0u, (uint8_t)127u));
  }
  if (candidate_beam_rs_list_present) {
    HANDLE_CODE(unpack_dyn_seq_of(candidate_beam_rs_list, bref, 1, 16));
  }
  if (ssb_per_rach_occasion_present) {
    HANDLE_CODE(ssb_per_rach_occasion.unpack(bref));
  }
  if (ra_ssb_occasion_mask_idx_present) {
    HANDLE_CODE(unpack_integer(ra_ssb_occasion_mask_idx, bref, (uint8_t)0u, (uint8_t)15u));
  }
  if (recovery_search_space_id_present) {
    HANDLE_CODE(unpack_integer(recovery_search_space_id, bref, (uint8_t)0u, (uint8_t)39u));
  }
  if (ra_prioritization_present) {
    HANDLE_CODE(ra_prioritization.unpack(bref));
  }
  if (beam_fail_recovery_timer_present) {
    HANDLE_CODE(beam_fail_recovery_timer.unpack(bref));
  }

  if (ext) {
    ext_groups_unpacker_guard group_flags(3);
    group_flags.unpack(bref);

    if (group_flags[0]) {
      varlength_field_unpack_guard varlen_scope(bref, false);

      HANDLE_CODE(bref.unpack(msg1_subcarrier_spacing_present, 1));
      if (msg1_subcarrier_spacing_present) {
        HANDLE_CODE(msg1_subcarrier_spacing.unpack(bref));
      }
    }
    if (group_flags[1]) {
      varlength_field_unpack_guard varlen_scope(bref, false);

      unpack_presence_flag(ra_prioritization_two_step_r16, bref);
      unpack_presence_flag(candidate_beam_rs_list_ext_v1610, bref);
      if (ra_prioritization_two_step_r16.is_present()) {
        HANDLE_CODE(ra_prioritization_two_step_r16->unpack(bref));
      }
      if (candidate_beam_rs_list_ext_v1610.is_present()) {
        HANDLE_CODE(candidate_beam_rs_list_ext_v1610->unpack(bref));
      }
    }
    if (group_flags[2]) {
      varlength_field_unpack_guard varlen_scope(bref, false);

      HANDLE_CODE(bref.unpack(sp_cell_bfr_cbra_r16_present, 1));
    }
  }
  return SRSASN_SUCCESS;
}
void beam_fail_recovery_cfg_s::to_json(json_writer& j) const
{
  j.start_obj();
  if (root_seq_idx_bfr_present) {
    j.write_int("rootSequenceIndex-BFR", root_seq_idx_bfr);
  }
  if (rach_cfg_bfr_present) {
    j.write_fieldname("rach-ConfigBFR");
    rach_cfg_bfr.to_json(j);
  }
  if (rsrp_thres_ssb_present) {
    j.write_int("rsrp-ThresholdSSB", rsrp_thres_ssb);
  }
  if (candidate_beam_rs_list.size() > 0) {
    j.start_array("candidateBeamRSList");
    for (const auto& e1 : candidate_beam_rs_list) {
      e1.to_json(j);
    }
    j.end_array();
  }
  if (ssb_per_rach_occasion_present) {
    j.write_str("ssb-perRACH-Occasion", ssb_per_rach_occasion.to_string());
  }
  if (ra_ssb_occasion_mask_idx_present) {
    j.write_int("ra-ssb-OccasionMaskIndex", ra_ssb_occasion_mask_idx);
  }
  if (recovery_search_space_id_present) {
    j.write_int("recoverySearchSpaceId", recovery_search_space_id);
  }
  if (ra_prioritization_present) {
    j.write_fieldname("ra-Prioritization");
    ra_prioritization.to_json(j);
  }
  if (beam_fail_recovery_timer_present) {
    j.write_str("beamFailureRecoveryTimer", beam_fail_recovery_timer.to_string());
  }
  if (ext) {
    if (msg1_subcarrier_spacing_present) {
      j.write_str("msg1-SubcarrierSpacing", msg1_subcarrier_spacing.to_string());
    }
    if (ra_prioritization_two_step_r16.is_present()) {
      j.write_fieldname("ra-PrioritizationTwoStep-r16");
      ra_prioritization_two_step_r16->to_json(j);
    }
    if (candidate_beam_rs_list_ext_v1610.is_present()) {
      j.write_fieldname("candidateBeamRSListExt-v1610");
      candidate_beam_rs_list_ext_v1610->to_json(j);
    }
    if (sp_cell_bfr_cbra_r16_present) {
      j.write_str("spCell-BFR-CBRA-r16", "true");
    }
  }
  j.end_obj();
}

const char* beam_fail_recovery_cfg_s::ssb_per_rach_occasion_opts::to_string() const
{
  static const char* names[] = {"oneEighth", "oneFourth", "oneHalf", "one", "two", "four", "eight", "sixteen"};
  return convert_enum_idx(names, 8, value, "beam_fail_recovery_cfg_s::ssb_per_rach_occasion_e_");
}
float beam_fail_recovery_cfg_s::ssb_per_rach_occasion_opts::to_number() const
{
  static const float numbers[] = {0.125, 0.25, 0.5, 1.0, 2.0, 4.0, 8.0, 6.0};
  return map_enum_number(numbers, 8, value, "beam_fail_recovery_cfg_s::ssb_per_rach_occasion_e_");
}
const char* beam_fail_recovery_cfg_s::ssb_per_rach_occasion_opts::to_number_string() const
{
  static const char* number_strs[] = {"1/8", "1/4", "1/2", "1", "2", "4", "8", "6"};
  return convert_enum_idx(number_strs, 8, value, "beam_fail_recovery_cfg_s::ssb_per_rach_occasion_e_");
}

const char* beam_fail_recovery_cfg_s::beam_fail_recovery_timer_opts::to_string() const
{
  static const char* names[] = {"ms10", "ms20", "ms40", "ms60", "ms80", "ms100", "ms150", "ms200"};
  return convert_enum_idx(names, 8, value, "beam_fail_recovery_cfg_s::beam_fail_recovery_timer_e_");
}
uint8_t beam_fail_recovery_cfg_s::beam_fail_recovery_timer_opts::to_number() const
{
  static const uint8_t numbers[] = {10, 20, 40, 60, 80, 100, 150, 200};
  return map_enum_number(numbers, 8, value, "beam_fail_recovery_cfg_s::beam_fail_recovery_timer_e_");
}

// LBT-FailureRecoveryConfig-r16 ::= SEQUENCE
SRSASN_CODE lbt_fail_recovery_cfg_r16_s::pack(bit_ref& bref) const
{
  bref.pack(ext, 1);
  HANDLE_CODE(lbt_fail_instance_max_count_r16.pack(bref));
  HANDLE_CODE(lbt_fail_detection_timer_r16.pack(bref));

  return SRSASN_SUCCESS;
}
SRSASN_CODE lbt_fail_recovery_cfg_r16_s::unpack(cbit_ref& bref)
{
  bref.unpack(ext, 1);
  HANDLE_CODE(lbt_fail_instance_max_count_r16.unpack(bref));
  HANDLE_CODE(lbt_fail_detection_timer_r16.unpack(bref));

  return SRSASN_SUCCESS;
}
void lbt_fail_recovery_cfg_r16_s::to_json(json_writer& j) const
{
  j.start_obj();
  j.write_str("lbt-FailureInstanceMaxCount-r16", lbt_fail_instance_max_count_r16.to_string());
  j.write_str("lbt-FailureDetectionTimer-r16", lbt_fail_detection_timer_r16.to_string());
  j.end_obj();
}

const char* lbt_fail_recovery_cfg_r16_s::lbt_fail_instance_max_count_r16_opts::to_string() const
{
  static const char* names[] = {"n4", "n8", "n16", "n32", "n64", "n128"};
  return convert_enum_idx(names, 6, value, "lbt_fail_recovery_cfg_r16_s::lbt_fail_instance_max_count_r16_e_");
}
uint8_t lbt_fail_recovery_cfg_r16_s::lbt_fail_instance_max_count_r16_opts::to_number() const
{
  static const uint8_t numbers[] = {4, 8, 16, 32, 64, 128};
  return map_enum_number(numbers, 6, value, "lbt_fail_recovery_cfg_r16_s::lbt_fail_instance_max_count_r16_e_");
}

const char* lbt_fail_recovery_cfg_r16_s::lbt_fail_detection_timer_r16_opts::to_string() const
{
  static const char* names[] = {"ms10", "ms20", "ms40", "ms80", "ms160", "ms320"};
  return convert_enum_idx(names, 6, value, "lbt_fail_recovery_cfg_r16_s::lbt_fail_detection_timer_r16_e_");
}
uint16_t lbt_fail_recovery_cfg_r16_s::lbt_fail_detection_timer_r16_opts::to_number() const
{
  static const uint16_t numbers[] = {10, 20, 40, 80, 160, 320};
  return map_enum_number(numbers, 6, value, "lbt_fail_recovery_cfg_r16_s::lbt_fail_detection_timer_r16_e_");
}

// PUSCH-Config ::= SEQUENCE
SRSASN_CODE pusch_cfg_s::pack(bit_ref& bref) const
{
  bref.pack(ext, 1);
  HANDLE_CODE(bref.pack(data_scrambling_id_pusch_present, 1));
  HANDLE_CODE(bref.pack(tx_cfg_present, 1));
  HANDLE_CODE(bref.pack(dmrs_ul_for_pusch_map_type_a_present, 1));
  HANDLE_CODE(bref.pack(dmrs_ul_for_pusch_map_type_b_present, 1));
  HANDLE_CODE(bref.pack(pusch_pwr_ctrl_present, 1));
  HANDLE_CODE(bref.pack(freq_hop_present, 1));
  HANDLE_CODE(bref.pack(freq_hop_offset_lists.size() > 0, 1));
  HANDLE_CODE(bref.pack(pusch_time_domain_alloc_list_present, 1));
  HANDLE_CODE(bref.pack(pusch_aggregation_factor_present, 1));
  HANDLE_CODE(bref.pack(mcs_table_present, 1));
  HANDLE_CODE(bref.pack(mcs_table_transform_precoder_present, 1));
  HANDLE_CODE(bref.pack(transform_precoder_present, 1));
  HANDLE_CODE(bref.pack(codebook_subset_present, 1));
  HANDLE_CODE(bref.pack(max_rank_present, 1));
  HANDLE_CODE(bref.pack(rbg_size_present, 1));
  HANDLE_CODE(bref.pack(uci_on_pusch_present, 1));
  HANDLE_CODE(bref.pack(tp_pi2_bpsk_present, 1));

  if (data_scrambling_id_pusch_present) {
    HANDLE_CODE(pack_integer(bref, data_scrambling_id_pusch, (uint16_t)0u, (uint16_t)1023u));
  }
  if (tx_cfg_present) {
    HANDLE_CODE(tx_cfg.pack(bref));
  }
  if (dmrs_ul_for_pusch_map_type_a_present) {
    HANDLE_CODE(dmrs_ul_for_pusch_map_type_a.pack(bref));
  }
  if (dmrs_ul_for_pusch_map_type_b_present) {
    HANDLE_CODE(dmrs_ul_for_pusch_map_type_b.pack(bref));
  }
  if (pusch_pwr_ctrl_present) {
    HANDLE_CODE(pusch_pwr_ctrl.pack(bref));
  }
  if (freq_hop_present) {
    HANDLE_CODE(freq_hop.pack(bref));
  }
  if (freq_hop_offset_lists.size() > 0) {
    HANDLE_CODE(pack_dyn_seq_of(bref, freq_hop_offset_lists, 1, 4, integer_packer<uint16_t>(1, 274)));
  }
  HANDLE_CODE(res_alloc.pack(bref));
  if (pusch_time_domain_alloc_list_present) {
    HANDLE_CODE(pusch_time_domain_alloc_list.pack(bref));
  }
  if (pusch_aggregation_factor_present) {
    HANDLE_CODE(pusch_aggregation_factor.pack(bref));
  }
  if (mcs_table_present) {
    HANDLE_CODE(mcs_table.pack(bref));
  }
  if (mcs_table_transform_precoder_present) {
    HANDLE_CODE(mcs_table_transform_precoder.pack(bref));
  }
  if (transform_precoder_present) {
    HANDLE_CODE(transform_precoder.pack(bref));
  }
  if (codebook_subset_present) {
    HANDLE_CODE(codebook_subset.pack(bref));
  }
  if (max_rank_present) {
    HANDLE_CODE(pack_integer(bref, max_rank, (uint8_t)1u, (uint8_t)4u));
  }
  if (uci_on_pusch_present) {
    HANDLE_CODE(uci_on_pusch.pack(bref));
  }

  if (ext) {
    ext_groups_packer_guard group_flags;
    group_flags[0] |= minimum_sched_offset_k2_r16.is_present();
    group_flags[0] |= ul_access_cfg_list_dci_0_1_r16.is_present();
    group_flags[0] |= harq_process_num_size_dci_0_2_r16_present;
    group_flags[0] |= dmrs_seq_initization_dci_0_2_r16_present;
    group_flags[0] |= nof_bits_for_rv_dci_0_2_r16_present;
    group_flags[0] |= ant_ports_field_presence_dci_0_2_r16_present;
    group_flags[0] |= dmrs_ul_for_pusch_map_type_a_dci_0_2_r16.is_present();
    group_flags[0] |= dmrs_ul_for_pusch_map_type_b_dci_0_2_r16.is_present();
    group_flags[0] |= freq_hop_dci_0_2_r16.is_present();
    group_flags[0] |= freq_hop_offset_lists_dci_0_2_r16.is_present();
    group_flags[0] |= codebook_subset_dci_0_2_r16_present;
    group_flags[0] |= invalid_symbol_pattern_ind_dci_0_2_r16_present;
    group_flags[0] |= max_rank_dci_0_2_r16_present;
    group_flags[0] |= mcs_table_dci_0_2_r16_present;
    group_flags[0] |= mcs_table_transform_precoder_dci_0_2_r16_present;
    group_flags[0] |= prio_ind_dci_0_2_r16_present;
    group_flags[0] |= pusch_rep_type_ind_dci_0_2_r16_present;
    group_flags[0] |= res_alloc_dci_0_2_r16_present;
    group_flags[0] |= res_alloc_type1_granularity_dci_0_2_r16_present;
    group_flags[0] |= uci_on_pusch_list_dci_0_2_r16.is_present();
    group_flags[0] |= pusch_time_domain_alloc_list_dci_0_2_r16.is_present();
    group_flags[0] |= pusch_time_domain_alloc_list_dci_0_1_r16.is_present();
    group_flags[0] |= invalid_symbol_pattern_ind_dci_0_1_r16_present;
    group_flags[0] |= prio_ind_dci_0_1_r16_present;
    group_flags[0] |= pusch_rep_type_ind_dci_0_1_r16_present;
    group_flags[0] |= freq_hop_dci_0_1_r16_present;
    group_flags[0] |= uci_on_pusch_list_dci_0_1_r16.is_present();
    group_flags[0] |= invalid_symbol_pattern_r16.is_present();
    group_flags[0] |= pusch_pwr_ctrl_v1610.is_present();
    group_flags[0] |= ul_full_pwr_tx_r16_present;
    group_flags[0] |= pusch_time_domain_alloc_list_for_multi_pusch_r16.is_present();
    group_flags[0] |= nof_invalid_symbols_for_dl_ul_switching_r16_present;
    group_flags[1] |= ul_access_cfg_list_dci_0_2_r17.is_present();
    group_flags[1] |= beta_offsets_cross_pri0_r17.is_present();
    group_flags[1] |= beta_offsets_cross_pri1_r17.is_present();
    group_flags[1] |= beta_offsets_cross_pri0_dci_0_2_r17.is_present();
    group_flags[1] |= beta_offsets_cross_pri1_dci_0_2_r17.is_present();
    group_flags[1] |= map_pattern_r17_present;
    group_flags[1] |= second_tpc_field_dci_0_1_r17_present;
    group_flags[1] |= second_tpc_field_dci_0_2_r17_present;
    group_flags[1] |= seq_offset_for_rv_r17_present;
    group_flags[1] |= ul_access_cfg_list_dci_0_1_r17.is_present();
    group_flags[1] |= minimum_sched_offset_k2_r17.is_present();
    group_flags[1] |= available_slot_count_r17_present;
    group_flags[1] |= dmrs_bundling_pusch_cfg_r17.is_present();
    group_flags[1] |= harq_process_num_size_dci_0_2_v1700_present;
    group_flags[1] |= harq_process_num_size_dci_0_1_r17_present;
    group_flags[1] |= mpe_res_pool_to_add_mod_list_r17.is_present();
    group_flags[1] |= mpe_res_pool_to_release_list_r17.is_present();
    group_flags.pack(bref);

    if (group_flags[0]) {
      varlength_field_pack_guard varlen_scope(bref, false);

      HANDLE_CODE(bref.pack(minimum_sched_offset_k2_r16.is_present(), 1));
      HANDLE_CODE(bref.pack(ul_access_cfg_list_dci_0_1_r16.is_present(), 1));
      HANDLE_CODE(bref.pack(harq_process_num_size_dci_0_2_r16_present, 1));
      HANDLE_CODE(bref.pack(dmrs_seq_initization_dci_0_2_r16_present, 1));
      HANDLE_CODE(bref.pack(nof_bits_for_rv_dci_0_2_r16_present, 1));
      HANDLE_CODE(bref.pack(ant_ports_field_presence_dci_0_2_r16_present, 1));
      HANDLE_CODE(bref.pack(dmrs_ul_for_pusch_map_type_a_dci_0_2_r16.is_present(), 1));
      HANDLE_CODE(bref.pack(dmrs_ul_for_pusch_map_type_b_dci_0_2_r16.is_present(), 1));
      HANDLE_CODE(bref.pack(freq_hop_dci_0_2_r16.is_present(), 1));
      HANDLE_CODE(bref.pack(freq_hop_offset_lists_dci_0_2_r16.is_present(), 1));
      HANDLE_CODE(bref.pack(codebook_subset_dci_0_2_r16_present, 1));
      HANDLE_CODE(bref.pack(invalid_symbol_pattern_ind_dci_0_2_r16_present, 1));
      HANDLE_CODE(bref.pack(max_rank_dci_0_2_r16_present, 1));
      HANDLE_CODE(bref.pack(mcs_table_dci_0_2_r16_present, 1));
      HANDLE_CODE(bref.pack(mcs_table_transform_precoder_dci_0_2_r16_present, 1));
      HANDLE_CODE(bref.pack(prio_ind_dci_0_2_r16_present, 1));
      HANDLE_CODE(bref.pack(pusch_rep_type_ind_dci_0_2_r16_present, 1));
      HANDLE_CODE(bref.pack(res_alloc_dci_0_2_r16_present, 1));
      HANDLE_CODE(bref.pack(res_alloc_type1_granularity_dci_0_2_r16_present, 1));
      HANDLE_CODE(bref.pack(uci_on_pusch_list_dci_0_2_r16.is_present(), 1));
      HANDLE_CODE(bref.pack(pusch_time_domain_alloc_list_dci_0_2_r16.is_present(), 1));
      HANDLE_CODE(bref.pack(pusch_time_domain_alloc_list_dci_0_1_r16.is_present(), 1));
      HANDLE_CODE(bref.pack(invalid_symbol_pattern_ind_dci_0_1_r16_present, 1));
      HANDLE_CODE(bref.pack(prio_ind_dci_0_1_r16_present, 1));
      HANDLE_CODE(bref.pack(pusch_rep_type_ind_dci_0_1_r16_present, 1));
      HANDLE_CODE(bref.pack(freq_hop_dci_0_1_r16_present, 1));
      HANDLE_CODE(bref.pack(uci_on_pusch_list_dci_0_1_r16.is_present(), 1));
      HANDLE_CODE(bref.pack(invalid_symbol_pattern_r16.is_present(), 1));
      HANDLE_CODE(bref.pack(pusch_pwr_ctrl_v1610.is_present(), 1));
      HANDLE_CODE(bref.pack(ul_full_pwr_tx_r16_present, 1));
      HANDLE_CODE(bref.pack(pusch_time_domain_alloc_list_for_multi_pusch_r16.is_present(), 1));
      HANDLE_CODE(bref.pack(nof_invalid_symbols_for_dl_ul_switching_r16_present, 1));
      if (minimum_sched_offset_k2_r16.is_present()) {
        HANDLE_CODE(minimum_sched_offset_k2_r16->pack(bref));
      }
      if (ul_access_cfg_list_dci_0_1_r16.is_present()) {
        HANDLE_CODE(ul_access_cfg_list_dci_0_1_r16->pack(bref));
      }
      if (harq_process_num_size_dci_0_2_r16_present) {
        HANDLE_CODE(pack_integer(bref, harq_process_num_size_dci_0_2_r16, (uint8_t)0u, (uint8_t)4u));
      }
      if (nof_bits_for_rv_dci_0_2_r16_present) {
        HANDLE_CODE(pack_integer(bref, nof_bits_for_rv_dci_0_2_r16, (uint8_t)0u, (uint8_t)2u));
      }
      if (dmrs_ul_for_pusch_map_type_a_dci_0_2_r16.is_present()) {
        HANDLE_CODE(dmrs_ul_for_pusch_map_type_a_dci_0_2_r16->pack(bref));
      }
      if (dmrs_ul_for_pusch_map_type_b_dci_0_2_r16.is_present()) {
        HANDLE_CODE(dmrs_ul_for_pusch_map_type_b_dci_0_2_r16->pack(bref));
      }
      if (freq_hop_dci_0_2_r16.is_present()) {
        HANDLE_CODE(freq_hop_dci_0_2_r16->pack(bref));
      }
      if (freq_hop_offset_lists_dci_0_2_r16.is_present()) {
        HANDLE_CODE(freq_hop_offset_lists_dci_0_2_r16->pack(bref));
      }
      if (codebook_subset_dci_0_2_r16_present) {
        HANDLE_CODE(codebook_subset_dci_0_2_r16.pack(bref));
      }
      if (max_rank_dci_0_2_r16_present) {
        HANDLE_CODE(pack_integer(bref, max_rank_dci_0_2_r16, (uint8_t)1u, (uint8_t)4u));
      }
      if (mcs_table_dci_0_2_r16_present) {
        HANDLE_CODE(mcs_table_dci_0_2_r16.pack(bref));
      }
      if (mcs_table_transform_precoder_dci_0_2_r16_present) {
        HANDLE_CODE(mcs_table_transform_precoder_dci_0_2_r16.pack(bref));
      }
      if (pusch_rep_type_ind_dci_0_2_r16_present) {
        HANDLE_CODE(pusch_rep_type_ind_dci_0_2_r16.pack(bref));
      }
      if (res_alloc_dci_0_2_r16_present) {
        HANDLE_CODE(res_alloc_dci_0_2_r16.pack(bref));
      }
      if (res_alloc_type1_granularity_dci_0_2_r16_present) {
        HANDLE_CODE(res_alloc_type1_granularity_dci_0_2_r16.pack(bref));
      }
      if (uci_on_pusch_list_dci_0_2_r16.is_present()) {
        HANDLE_CODE(uci_on_pusch_list_dci_0_2_r16->pack(bref));
      }
      if (pusch_time_domain_alloc_list_dci_0_2_r16.is_present()) {
        HANDLE_CODE(pusch_time_domain_alloc_list_dci_0_2_r16->pack(bref));
      }
      if (pusch_time_domain_alloc_list_dci_0_1_r16.is_present()) {
        HANDLE_CODE(pusch_time_domain_alloc_list_dci_0_1_r16->pack(bref));
      }
      if (pusch_rep_type_ind_dci_0_1_r16_present) {
        HANDLE_CODE(pusch_rep_type_ind_dci_0_1_r16.pack(bref));
      }
      if (freq_hop_dci_0_1_r16_present) {
        HANDLE_CODE(freq_hop_dci_0_1_r16.pack(bref));
      }
      if (uci_on_pusch_list_dci_0_1_r16.is_present()) {
        HANDLE_CODE(uci_on_pusch_list_dci_0_1_r16->pack(bref));
      }
      if (invalid_symbol_pattern_r16.is_present()) {
        HANDLE_CODE(invalid_symbol_pattern_r16->pack(bref));
      }
      if (pusch_pwr_ctrl_v1610.is_present()) {
        HANDLE_CODE(pusch_pwr_ctrl_v1610->pack(bref));
      }
      if (ul_full_pwr_tx_r16_present) {
        HANDLE_CODE(ul_full_pwr_tx_r16.pack(bref));
      }
      if (pusch_time_domain_alloc_list_for_multi_pusch_r16.is_present()) {
        HANDLE_CODE(pusch_time_domain_alloc_list_for_multi_pusch_r16->pack(bref));
      }
      if (nof_invalid_symbols_for_dl_ul_switching_r16_present) {
        HANDLE_CODE(pack_integer(bref, nof_invalid_symbols_for_dl_ul_switching_r16, (uint8_t)1u, (uint8_t)4u));
      }
    }
    if (group_flags[1]) {
      varlength_field_pack_guard varlen_scope(bref, false);

      HANDLE_CODE(bref.pack(ul_access_cfg_list_dci_0_2_r17.is_present(), 1));
      HANDLE_CODE(bref.pack(beta_offsets_cross_pri0_r17.is_present(), 1));
      HANDLE_CODE(bref.pack(beta_offsets_cross_pri1_r17.is_present(), 1));
      HANDLE_CODE(bref.pack(beta_offsets_cross_pri0_dci_0_2_r17.is_present(), 1));
      HANDLE_CODE(bref.pack(beta_offsets_cross_pri1_dci_0_2_r17.is_present(), 1));
      HANDLE_CODE(bref.pack(map_pattern_r17_present, 1));
      HANDLE_CODE(bref.pack(second_tpc_field_dci_0_1_r17_present, 1));
      HANDLE_CODE(bref.pack(second_tpc_field_dci_0_2_r17_present, 1));
      HANDLE_CODE(bref.pack(seq_offset_for_rv_r17_present, 1));
      HANDLE_CODE(bref.pack(ul_access_cfg_list_dci_0_1_r17.is_present(), 1));
      HANDLE_CODE(bref.pack(minimum_sched_offset_k2_r17.is_present(), 1));
      HANDLE_CODE(bref.pack(available_slot_count_r17_present, 1));
      HANDLE_CODE(bref.pack(dmrs_bundling_pusch_cfg_r17.is_present(), 1));
      HANDLE_CODE(bref.pack(harq_process_num_size_dci_0_2_v1700_present, 1));
      HANDLE_CODE(bref.pack(harq_process_num_size_dci_0_1_r17_present, 1));
      HANDLE_CODE(bref.pack(mpe_res_pool_to_add_mod_list_r17.is_present(), 1));
      HANDLE_CODE(bref.pack(mpe_res_pool_to_release_list_r17.is_present(), 1));
      if (ul_access_cfg_list_dci_0_2_r17.is_present()) {
        HANDLE_CODE(ul_access_cfg_list_dci_0_2_r17->pack(bref));
      }
      if (beta_offsets_cross_pri0_r17.is_present()) {
        HANDLE_CODE(beta_offsets_cross_pri0_r17->pack(bref));
      }
      if (beta_offsets_cross_pri1_r17.is_present()) {
        HANDLE_CODE(beta_offsets_cross_pri1_r17->pack(bref));
      }
      if (beta_offsets_cross_pri0_dci_0_2_r17.is_present()) {
        HANDLE_CODE(beta_offsets_cross_pri0_dci_0_2_r17->pack(bref));
      }
      if (beta_offsets_cross_pri1_dci_0_2_r17.is_present()) {
        HANDLE_CODE(beta_offsets_cross_pri1_dci_0_2_r17->pack(bref));
      }
      if (map_pattern_r17_present) {
        HANDLE_CODE(map_pattern_r17.pack(bref));
      }
      if (seq_offset_for_rv_r17_present) {
        HANDLE_CODE(pack_integer(bref, seq_offset_for_rv_r17, (uint8_t)0u, (uint8_t)3u));
      }
      if (ul_access_cfg_list_dci_0_1_r17.is_present()) {
        HANDLE_CODE(ul_access_cfg_list_dci_0_1_r17->pack(bref));
      }
      if (minimum_sched_offset_k2_r17.is_present()) {
        HANDLE_CODE(minimum_sched_offset_k2_r17->pack(bref));
      }
      if (dmrs_bundling_pusch_cfg_r17.is_present()) {
        HANDLE_CODE(dmrs_bundling_pusch_cfg_r17->pack(bref));
      }
      if (harq_process_num_size_dci_0_2_v1700_present) {
        HANDLE_CODE(pack_integer(bref, harq_process_num_size_dci_0_2_v1700, (uint8_t)5u, (uint8_t)5u));
      }
      if (harq_process_num_size_dci_0_1_r17_present) {
        HANDLE_CODE(pack_integer(bref, harq_process_num_size_dci_0_1_r17, (uint8_t)5u, (uint8_t)5u));
      }
      if (mpe_res_pool_to_add_mod_list_r17.is_present()) {
        HANDLE_CODE(pack_dyn_seq_of(bref, *mpe_res_pool_to_add_mod_list_r17, 1, 64));
      }
      if (mpe_res_pool_to_release_list_r17.is_present()) {
        HANDLE_CODE(pack_dyn_seq_of(bref, *mpe_res_pool_to_release_list_r17, 1, 64, integer_packer<uint8_t>(1, 64)));
      }
    }
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE pusch_cfg_s::unpack(cbit_ref& bref)
{
  bref.unpack(ext, 1);
  HANDLE_CODE(bref.unpack(data_scrambling_id_pusch_present, 1));
  HANDLE_CODE(bref.unpack(tx_cfg_present, 1));
  HANDLE_CODE(bref.unpack(dmrs_ul_for_pusch_map_type_a_present, 1));
  HANDLE_CODE(bref.unpack(dmrs_ul_for_pusch_map_type_b_present, 1));
  HANDLE_CODE(bref.unpack(pusch_pwr_ctrl_present, 1));
  HANDLE_CODE(bref.unpack(freq_hop_present, 1));
  bool freq_hop_offset_lists_present;
  HANDLE_CODE(bref.unpack(freq_hop_offset_lists_present, 1));
  HANDLE_CODE(bref.unpack(pusch_time_domain_alloc_list_present, 1));
  HANDLE_CODE(bref.unpack(pusch_aggregation_factor_present, 1));
  HANDLE_CODE(bref.unpack(mcs_table_present, 1));
  HANDLE_CODE(bref.unpack(mcs_table_transform_precoder_present, 1));
  HANDLE_CODE(bref.unpack(transform_precoder_present, 1));
  HANDLE_CODE(bref.unpack(codebook_subset_present, 1));
  HANDLE_CODE(bref.unpack(max_rank_present, 1));
  HANDLE_CODE(bref.unpack(rbg_size_present, 1));
  HANDLE_CODE(bref.unpack(uci_on_pusch_present, 1));
  HANDLE_CODE(bref.unpack(tp_pi2_bpsk_present, 1));

  if (data_scrambling_id_pusch_present) {
    HANDLE_CODE(unpack_integer(data_scrambling_id_pusch, bref, (uint16_t)0u, (uint16_t)1023u));
  }
  if (tx_cfg_present) {
    HANDLE_CODE(tx_cfg.unpack(bref));
  }
  if (dmrs_ul_for_pusch_map_type_a_present) {
    HANDLE_CODE(dmrs_ul_for_pusch_map_type_a.unpack(bref));
  }
  if (dmrs_ul_for_pusch_map_type_b_present) {
    HANDLE_CODE(dmrs_ul_for_pusch_map_type_b.unpack(bref));
  }
  if (pusch_pwr_ctrl_present) {
    HANDLE_CODE(pusch_pwr_ctrl.unpack(bref));
  }
  if (freq_hop_present) {
    HANDLE_CODE(freq_hop.unpack(bref));
  }
  if (freq_hop_offset_lists_present) {
    HANDLE_CODE(unpack_dyn_seq_of(freq_hop_offset_lists, bref, 1, 4, integer_packer<uint16_t>(1, 274)));
  }
  HANDLE_CODE(res_alloc.unpack(bref));
  if (pusch_time_domain_alloc_list_present) {
    HANDLE_CODE(pusch_time_domain_alloc_list.unpack(bref));
  }
  if (pusch_aggregation_factor_present) {
    HANDLE_CODE(pusch_aggregation_factor.unpack(bref));
  }
  if (mcs_table_present) {
    HANDLE_CODE(mcs_table.unpack(bref));
  }
  if (mcs_table_transform_precoder_present) {
    HANDLE_CODE(mcs_table_transform_precoder.unpack(bref));
  }
  if (transform_precoder_present) {
    HANDLE_CODE(transform_precoder.unpack(bref));
  }
  if (codebook_subset_present) {
    HANDLE_CODE(codebook_subset.unpack(bref));
  }
  if (max_rank_present) {
    HANDLE_CODE(unpack_integer(max_rank, bref, (uint8_t)1u, (uint8_t)4u));
  }
  if (uci_on_pusch_present) {
    HANDLE_CODE(uci_on_pusch.unpack(bref));
  }

  if (ext) {
    ext_groups_unpacker_guard group_flags(2);
    group_flags.unpack(bref);

    if (group_flags[0]) {
      varlength_field_unpack_guard varlen_scope(bref, false);

      unpack_presence_flag(minimum_sched_offset_k2_r16, bref);
      unpack_presence_flag(ul_access_cfg_list_dci_0_1_r16, bref);
      HANDLE_CODE(bref.unpack(harq_process_num_size_dci_0_2_r16_present, 1));
      HANDLE_CODE(bref.unpack(dmrs_seq_initization_dci_0_2_r16_present, 1));
      HANDLE_CODE(bref.unpack(nof_bits_for_rv_dci_0_2_r16_present, 1));
      HANDLE_CODE(bref.unpack(ant_ports_field_presence_dci_0_2_r16_present, 1));
      unpack_presence_flag(dmrs_ul_for_pusch_map_type_a_dci_0_2_r16, bref);
      unpack_presence_flag(dmrs_ul_for_pusch_map_type_b_dci_0_2_r16, bref);
      unpack_presence_flag(freq_hop_dci_0_2_r16, bref);
      unpack_presence_flag(freq_hop_offset_lists_dci_0_2_r16, bref);
      HANDLE_CODE(bref.unpack(codebook_subset_dci_0_2_r16_present, 1));
      HANDLE_CODE(bref.unpack(invalid_symbol_pattern_ind_dci_0_2_r16_present, 1));
      HANDLE_CODE(bref.unpack(max_rank_dci_0_2_r16_present, 1));
      HANDLE_CODE(bref.unpack(mcs_table_dci_0_2_r16_present, 1));
      HANDLE_CODE(bref.unpack(mcs_table_transform_precoder_dci_0_2_r16_present, 1));
      HANDLE_CODE(bref.unpack(prio_ind_dci_0_2_r16_present, 1));
      HANDLE_CODE(bref.unpack(pusch_rep_type_ind_dci_0_2_r16_present, 1));
      HANDLE_CODE(bref.unpack(res_alloc_dci_0_2_r16_present, 1));
      HANDLE_CODE(bref.unpack(res_alloc_type1_granularity_dci_0_2_r16_present, 1));
      unpack_presence_flag(uci_on_pusch_list_dci_0_2_r16, bref);
      unpack_presence_flag(pusch_time_domain_alloc_list_dci_0_2_r16, bref);
      unpack_presence_flag(pusch_time_domain_alloc_list_dci_0_1_r16, bref);
      HANDLE_CODE(bref.unpack(invalid_symbol_pattern_ind_dci_0_1_r16_present, 1));
      HANDLE_CODE(bref.unpack(prio_ind_dci_0_1_r16_present, 1));
      HANDLE_CODE(bref.unpack(pusch_rep_type_ind_dci_0_1_r16_present, 1));
      HANDLE_CODE(bref.unpack(freq_hop_dci_0_1_r16_present, 1));
      unpack_presence_flag(uci_on_pusch_list_dci_0_1_r16, bref);
      unpack_presence_flag(invalid_symbol_pattern_r16, bref);
      unpack_presence_flag(pusch_pwr_ctrl_v1610, bref);
      HANDLE_CODE(bref.unpack(ul_full_pwr_tx_r16_present, 1));
      unpack_presence_flag(pusch_time_domain_alloc_list_for_multi_pusch_r16, bref);
      HANDLE_CODE(bref.unpack(nof_invalid_symbols_for_dl_ul_switching_r16_present, 1));
      if (minimum_sched_offset_k2_r16.is_present()) {
        HANDLE_CODE(minimum_sched_offset_k2_r16->unpack(bref));
      }
      if (ul_access_cfg_list_dci_0_1_r16.is_present()) {
        HANDLE_CODE(ul_access_cfg_list_dci_0_1_r16->unpack(bref));
      }
      if (harq_process_num_size_dci_0_2_r16_present) {
        HANDLE_CODE(unpack_integer(harq_process_num_size_dci_0_2_r16, bref, (uint8_t)0u, (uint8_t)4u));
      }
      if (nof_bits_for_rv_dci_0_2_r16_present) {
        HANDLE_CODE(unpack_integer(nof_bits_for_rv_dci_0_2_r16, bref, (uint8_t)0u, (uint8_t)2u));
      }
      if (dmrs_ul_for_pusch_map_type_a_dci_0_2_r16.is_present()) {
        HANDLE_CODE(dmrs_ul_for_pusch_map_type_a_dci_0_2_r16->unpack(bref));
      }
      if (dmrs_ul_for_pusch_map_type_b_dci_0_2_r16.is_present()) {
        HANDLE_CODE(dmrs_ul_for_pusch_map_type_b_dci_0_2_r16->unpack(bref));
      }
      if (freq_hop_dci_0_2_r16.is_present()) {
        HANDLE_CODE(freq_hop_dci_0_2_r16->unpack(bref));
      }
      if (freq_hop_offset_lists_dci_0_2_r16.is_present()) {
        HANDLE_CODE(freq_hop_offset_lists_dci_0_2_r16->unpack(bref));
      }
      if (codebook_subset_dci_0_2_r16_present) {
        HANDLE_CODE(codebook_subset_dci_0_2_r16.unpack(bref));
      }
      if (max_rank_dci_0_2_r16_present) {
        HANDLE_CODE(unpack_integer(max_rank_dci_0_2_r16, bref, (uint8_t)1u, (uint8_t)4u));
      }
      if (mcs_table_dci_0_2_r16_present) {
        HANDLE_CODE(mcs_table_dci_0_2_r16.unpack(bref));
      }
      if (mcs_table_transform_precoder_dci_0_2_r16_present) {
        HANDLE_CODE(mcs_table_transform_precoder_dci_0_2_r16.unpack(bref));
      }
      if (pusch_rep_type_ind_dci_0_2_r16_present) {
        HANDLE_CODE(pusch_rep_type_ind_dci_0_2_r16.unpack(bref));
      }
      if (res_alloc_dci_0_2_r16_present) {
        HANDLE_CODE(res_alloc_dci_0_2_r16.unpack(bref));
      }
      if (res_alloc_type1_granularity_dci_0_2_r16_present) {
        HANDLE_CODE(res_alloc_type1_granularity_dci_0_2_r16.unpack(bref));
      }
      if (uci_on_pusch_list_dci_0_2_r16.is_present()) {
        HANDLE_CODE(uci_on_pusch_list_dci_0_2_r16->unpack(bref));
      }
      if (pusch_time_domain_alloc_list_dci_0_2_r16.is_present()) {
        HANDLE_CODE(pusch_time_domain_alloc_list_dci_0_2_r16->unpack(bref));
      }
      if (pusch_time_domain_alloc_list_dci_0_1_r16.is_present()) {
        HANDLE_CODE(pusch_time_domain_alloc_list_dci_0_1_r16->unpack(bref));
      }
      if (pusch_rep_type_ind_dci_0_1_r16_present) {
        HANDLE_CODE(pusch_rep_type_ind_dci_0_1_r16.unpack(bref));
      }
      if (freq_hop_dci_0_1_r16_present) {
        HANDLE_CODE(freq_hop_dci_0_1_r16.unpack(bref));
      }
      if (uci_on_pusch_list_dci_0_1_r16.is_present()) {
        HANDLE_CODE(uci_on_pusch_list_dci_0_1_r16->unpack(bref));
      }
      if (invalid_symbol_pattern_r16.is_present()) {
        HANDLE_CODE(invalid_symbol_pattern_r16->unpack(bref));
      }
      if (pusch_pwr_ctrl_v1610.is_present()) {
        HANDLE_CODE(pusch_pwr_ctrl_v1610->unpack(bref));
      }
      if (ul_full_pwr_tx_r16_present) {
        HANDLE_CODE(ul_full_pwr_tx_r16.unpack(bref));
      }
      if (pusch_time_domain_alloc_list_for_multi_pusch_r16.is_present()) {
        HANDLE_CODE(pusch_time_domain_alloc_list_for_multi_pusch_r16->unpack(bref));
      }
      if (nof_invalid_symbols_for_dl_ul_switching_r16_present) {
        HANDLE_CODE(unpack_integer(nof_invalid_symbols_for_dl_ul_switching_r16, bref, (uint8_t)1u, (uint8_t)4u));
      }
    }
    if (group_flags[1]) {
      varlength_field_unpack_guard varlen_scope(bref, false);

      unpack_presence_flag(ul_access_cfg_list_dci_0_2_r17, bref);
      unpack_presence_flag(beta_offsets_cross_pri0_r17, bref);
      unpack_presence_flag(beta_offsets_cross_pri1_r17, bref);
      unpack_presence_flag(beta_offsets_cross_pri0_dci_0_2_r17, bref);
      unpack_presence_flag(beta_offsets_cross_pri1_dci_0_2_r17, bref);
      HANDLE_CODE(bref.unpack(map_pattern_r17_present, 1));
      HANDLE_CODE(bref.unpack(second_tpc_field_dci_0_1_r17_present, 1));
      HANDLE_CODE(bref.unpack(second_tpc_field_dci_0_2_r17_present, 1));
      HANDLE_CODE(bref.unpack(seq_offset_for_rv_r17_present, 1));
      unpack_presence_flag(ul_access_cfg_list_dci_0_1_r17, bref);
      unpack_presence_flag(minimum_sched_offset_k2_r17, bref);
      HANDLE_CODE(bref.unpack(available_slot_count_r17_present, 1));
      unpack_presence_flag(dmrs_bundling_pusch_cfg_r17, bref);
      HANDLE_CODE(bref.unpack(harq_process_num_size_dci_0_2_v1700_present, 1));
      HANDLE_CODE(bref.unpack(harq_process_num_size_dci_0_1_r17_present, 1));
      unpack_presence_flag(mpe_res_pool_to_add_mod_list_r17, bref);
      unpack_presence_flag(mpe_res_pool_to_release_list_r17, bref);
      if (ul_access_cfg_list_dci_0_2_r17.is_present()) {
        HANDLE_CODE(ul_access_cfg_list_dci_0_2_r17->unpack(bref));
      }
      if (beta_offsets_cross_pri0_r17.is_present()) {
        HANDLE_CODE(beta_offsets_cross_pri0_r17->unpack(bref));
      }
      if (beta_offsets_cross_pri1_r17.is_present()) {
        HANDLE_CODE(beta_offsets_cross_pri1_r17->unpack(bref));
      }
      if (beta_offsets_cross_pri0_dci_0_2_r17.is_present()) {
        HANDLE_CODE(beta_offsets_cross_pri0_dci_0_2_r17->unpack(bref));
      }
      if (beta_offsets_cross_pri1_dci_0_2_r17.is_present()) {
        HANDLE_CODE(beta_offsets_cross_pri1_dci_0_2_r17->unpack(bref));
      }
      if (map_pattern_r17_present) {
        HANDLE_CODE(map_pattern_r17.unpack(bref));
      }
      if (seq_offset_for_rv_r17_present) {
        HANDLE_CODE(unpack_integer(seq_offset_for_rv_r17, bref, (uint8_t)0u, (uint8_t)3u));
      }
      if (ul_access_cfg_list_dci_0_1_r17.is_present()) {
        HANDLE_CODE(ul_access_cfg_list_dci_0_1_r17->unpack(bref));
      }
      if (minimum_sched_offset_k2_r17.is_present()) {
        HANDLE_CODE(minimum_sched_offset_k2_r17->unpack(bref));
      }
      if (dmrs_bundling_pusch_cfg_r17.is_present()) {
        HANDLE_CODE(dmrs_bundling_pusch_cfg_r17->unpack(bref));
      }
      if (harq_process_num_size_dci_0_2_v1700_present) {
        HANDLE_CODE(unpack_integer(harq_process_num_size_dci_0_2_v1700, bref, (uint8_t)5u, (uint8_t)5u));
      }
      if (harq_process_num_size_dci_0_1_r17_present) {
        HANDLE_CODE(unpack_integer(harq_process_num_size_dci_0_1_r17, bref, (uint8_t)5u, (uint8_t)5u));
      }
      if (mpe_res_pool_to_add_mod_list_r17.is_present()) {
        HANDLE_CODE(unpack_dyn_seq_of(*mpe_res_pool_to_add_mod_list_r17, bref, 1, 64));
      }
      if (mpe_res_pool_to_release_list_r17.is_present()) {
        HANDLE_CODE(unpack_dyn_seq_of(*mpe_res_pool_to_release_list_r17, bref, 1, 64, integer_packer<uint8_t>(1, 64)));
      }
    }
  }
  return SRSASN_SUCCESS;
}
void pusch_cfg_s::to_json(json_writer& j) const
{
  j.start_obj();
  if (data_scrambling_id_pusch_present) {
    j.write_int("dataScramblingIdentityPUSCH", data_scrambling_id_pusch);
  }
  if (tx_cfg_present) {
    j.write_str("txConfig", tx_cfg.to_string());
  }
  if (dmrs_ul_for_pusch_map_type_a_present) {
    j.write_fieldname("dmrs-UplinkForPUSCH-MappingTypeA");
    dmrs_ul_for_pusch_map_type_a.to_json(j);
  }
  if (dmrs_ul_for_pusch_map_type_b_present) {
    j.write_fieldname("dmrs-UplinkForPUSCH-MappingTypeB");
    dmrs_ul_for_pusch_map_type_b.to_json(j);
  }
  if (pusch_pwr_ctrl_present) {
    j.write_fieldname("pusch-PowerControl");
    pusch_pwr_ctrl.to_json(j);
  }
  if (freq_hop_present) {
    j.write_str("frequencyHopping", freq_hop.to_string());
  }
  if (freq_hop_offset_lists.size() > 0) {
    j.start_array("frequencyHoppingOffsetLists");
    for (const auto& e1 : freq_hop_offset_lists) {
      j.write_int(e1);
    }
    j.end_array();
  }
  j.write_str("resourceAllocation", res_alloc.to_string());
  if (pusch_time_domain_alloc_list_present) {
    j.write_fieldname("pusch-TimeDomainAllocationList");
    pusch_time_domain_alloc_list.to_json(j);
  }
  if (pusch_aggregation_factor_present) {
    j.write_str("pusch-AggregationFactor", pusch_aggregation_factor.to_string());
  }
  if (mcs_table_present) {
    j.write_str("mcs-Table", mcs_table.to_string());
  }
  if (mcs_table_transform_precoder_present) {
    j.write_str("mcs-TableTransformPrecoder", mcs_table_transform_precoder.to_string());
  }
  if (transform_precoder_present) {
    j.write_str("transformPrecoder", transform_precoder.to_string());
  }
  if (codebook_subset_present) {
    j.write_str("codebookSubset", codebook_subset.to_string());
  }
  if (max_rank_present) {
    j.write_int("maxRank", max_rank);
  }
  if (rbg_size_present) {
    j.write_str("rbg-Size", "config2");
  }
  if (uci_on_pusch_present) {
    j.write_fieldname("uci-OnPUSCH");
    uci_on_pusch.to_json(j);
  }
  if (tp_pi2_bpsk_present) {
    j.write_str("tp-pi2BPSK", "enabled");
  }
  if (ext) {
    if (minimum_sched_offset_k2_r16.is_present()) {
      j.write_fieldname("minimumSchedulingOffsetK2-r16");
      minimum_sched_offset_k2_r16->to_json(j);
    }
    if (ul_access_cfg_list_dci_0_1_r16.is_present()) {
      j.write_fieldname("ul-AccessConfigListDCI-0-1-r16");
      ul_access_cfg_list_dci_0_1_r16->to_json(j);
    }
    if (harq_process_num_size_dci_0_2_r16_present) {
      j.write_int("harq-ProcessNumberSizeDCI-0-2-r16", harq_process_num_size_dci_0_2_r16);
    }
    if (dmrs_seq_initization_dci_0_2_r16_present) {
      j.write_str("dmrs-SequenceInitializationDCI-0-2-r16", "enabled");
    }
    if (nof_bits_for_rv_dci_0_2_r16_present) {
      j.write_int("numberOfBitsForRV-DCI-0-2-r16", nof_bits_for_rv_dci_0_2_r16);
    }
    if (ant_ports_field_presence_dci_0_2_r16_present) {
      j.write_str("antennaPortsFieldPresenceDCI-0-2-r16", "enabled");
    }
    if (dmrs_ul_for_pusch_map_type_a_dci_0_2_r16.is_present()) {
      j.write_fieldname("dmrs-UplinkForPUSCH-MappingTypeA-DCI-0-2-r16");
      dmrs_ul_for_pusch_map_type_a_dci_0_2_r16->to_json(j);
    }
    if (dmrs_ul_for_pusch_map_type_b_dci_0_2_r16.is_present()) {
      j.write_fieldname("dmrs-UplinkForPUSCH-MappingTypeB-DCI-0-2-r16");
      dmrs_ul_for_pusch_map_type_b_dci_0_2_r16->to_json(j);
    }
    if (freq_hop_dci_0_2_r16.is_present()) {
      j.write_fieldname("frequencyHoppingDCI-0-2-r16");
      freq_hop_dci_0_2_r16->to_json(j);
    }
    if (freq_hop_offset_lists_dci_0_2_r16.is_present()) {
      j.write_fieldname("frequencyHoppingOffsetListsDCI-0-2-r16");
      freq_hop_offset_lists_dci_0_2_r16->to_json(j);
    }
    if (codebook_subset_dci_0_2_r16_present) {
      j.write_str("codebookSubsetDCI-0-2-r16", codebook_subset_dci_0_2_r16.to_string());
    }
    if (invalid_symbol_pattern_ind_dci_0_2_r16_present) {
      j.write_str("invalidSymbolPatternIndicatorDCI-0-2-r16", "enabled");
    }
    if (max_rank_dci_0_2_r16_present) {
      j.write_int("maxRankDCI-0-2-r16", max_rank_dci_0_2_r16);
    }
    if (mcs_table_dci_0_2_r16_present) {
      j.write_str("mcs-TableDCI-0-2-r16", mcs_table_dci_0_2_r16.to_string());
    }
    if (mcs_table_transform_precoder_dci_0_2_r16_present) {
      j.write_str("mcs-TableTransformPrecoderDCI-0-2-r16", mcs_table_transform_precoder_dci_0_2_r16.to_string());
    }
    if (prio_ind_dci_0_2_r16_present) {
      j.write_str("priorityIndicatorDCI-0-2-r16", "enabled");
    }
    if (pusch_rep_type_ind_dci_0_2_r16_present) {
      j.write_str("pusch-RepTypeIndicatorDCI-0-2-r16", pusch_rep_type_ind_dci_0_2_r16.to_string());
    }
    if (res_alloc_dci_0_2_r16_present) {
      j.write_str("resourceAllocationDCI-0-2-r16", res_alloc_dci_0_2_r16.to_string());
    }
    if (res_alloc_type1_granularity_dci_0_2_r16_present) {
      j.write_str("resourceAllocationType1GranularityDCI-0-2-r16", res_alloc_type1_granularity_dci_0_2_r16.to_string());
    }
    if (uci_on_pusch_list_dci_0_2_r16.is_present()) {
      j.write_fieldname("uci-OnPUSCH-ListDCI-0-2-r16");
      uci_on_pusch_list_dci_0_2_r16->to_json(j);
    }
    if (pusch_time_domain_alloc_list_dci_0_2_r16.is_present()) {
      j.write_fieldname("pusch-TimeDomainAllocationListDCI-0-2-r16");
      pusch_time_domain_alloc_list_dci_0_2_r16->to_json(j);
    }
    if (pusch_time_domain_alloc_list_dci_0_1_r16.is_present()) {
      j.write_fieldname("pusch-TimeDomainAllocationListDCI-0-1-r16");
      pusch_time_domain_alloc_list_dci_0_1_r16->to_json(j);
    }
    if (invalid_symbol_pattern_ind_dci_0_1_r16_present) {
      j.write_str("invalidSymbolPatternIndicatorDCI-0-1-r16", "enabled");
    }
    if (prio_ind_dci_0_1_r16_present) {
      j.write_str("priorityIndicatorDCI-0-1-r16", "enabled");
    }
    if (pusch_rep_type_ind_dci_0_1_r16_present) {
      j.write_str("pusch-RepTypeIndicatorDCI-0-1-r16", pusch_rep_type_ind_dci_0_1_r16.to_string());
    }
    if (freq_hop_dci_0_1_r16_present) {
      j.write_str("frequencyHoppingDCI-0-1-r16", freq_hop_dci_0_1_r16.to_string());
    }
    if (uci_on_pusch_list_dci_0_1_r16.is_present()) {
      j.write_fieldname("uci-OnPUSCH-ListDCI-0-1-r16");
      uci_on_pusch_list_dci_0_1_r16->to_json(j);
    }
    if (invalid_symbol_pattern_r16.is_present()) {
      j.write_fieldname("invalidSymbolPattern-r16");
      invalid_symbol_pattern_r16->to_json(j);
    }
    if (pusch_pwr_ctrl_v1610.is_present()) {
      j.write_fieldname("pusch-PowerControl-v1610");
      pusch_pwr_ctrl_v1610->to_json(j);
    }
    if (ul_full_pwr_tx_r16_present) {
      j.write_str("ul-FullPowerTransmission-r16", ul_full_pwr_tx_r16.to_string());
    }
    if (pusch_time_domain_alloc_list_for_multi_pusch_r16.is_present()) {
      j.write_fieldname("pusch-TimeDomainAllocationListForMultiPUSCH-r16");
      pusch_time_domain_alloc_list_for_multi_pusch_r16->to_json(j);
    }
    if (nof_invalid_symbols_for_dl_ul_switching_r16_present) {
      j.write_int("numberOfInvalidSymbolsForDL-UL-Switching-r16", nof_invalid_symbols_for_dl_ul_switching_r16);
    }
    if (ul_access_cfg_list_dci_0_2_r17.is_present()) {
      j.write_fieldname("ul-AccessConfigListDCI-0-2-r17");
      ul_access_cfg_list_dci_0_2_r17->to_json(j);
    }
    if (beta_offsets_cross_pri0_r17.is_present()) {
      j.write_fieldname("betaOffsetsCrossPri0-r17");
      beta_offsets_cross_pri0_r17->to_json(j);
    }
    if (beta_offsets_cross_pri1_r17.is_present()) {
      j.write_fieldname("betaOffsetsCrossPri1-r17");
      beta_offsets_cross_pri1_r17->to_json(j);
    }
    if (beta_offsets_cross_pri0_dci_0_2_r17.is_present()) {
      j.write_fieldname("betaOffsetsCrossPri0DCI-0-2-r17");
      beta_offsets_cross_pri0_dci_0_2_r17->to_json(j);
    }
    if (beta_offsets_cross_pri1_dci_0_2_r17.is_present()) {
      j.write_fieldname("betaOffsetsCrossPri1DCI-0-2-r17");
      beta_offsets_cross_pri1_dci_0_2_r17->to_json(j);
    }
    if (map_pattern_r17_present) {
      j.write_str("mappingPattern-r17", map_pattern_r17.to_string());
    }
    if (second_tpc_field_dci_0_1_r17_present) {
      j.write_str("secondTPCFieldDCI-0-1-r17", "enabled");
    }
    if (second_tpc_field_dci_0_2_r17_present) {
      j.write_str("secondTPCFieldDCI-0-2-r17", "enabled");
    }
    if (seq_offset_for_rv_r17_present) {
      j.write_int("sequenceOffsetForRV-r17", seq_offset_for_rv_r17);
    }
    if (ul_access_cfg_list_dci_0_1_r17.is_present()) {
      j.write_fieldname("ul-AccessConfigListDCI-0-1-r17");
      ul_access_cfg_list_dci_0_1_r17->to_json(j);
    }
    if (minimum_sched_offset_k2_r17.is_present()) {
      j.write_fieldname("minimumSchedulingOffsetK2-r17");
      minimum_sched_offset_k2_r17->to_json(j);
    }
    if (available_slot_count_r17_present) {
      j.write_str("availableSlotCounting-r17", "enabled");
    }
    if (dmrs_bundling_pusch_cfg_r17.is_present()) {
      j.write_fieldname("dmrs-BundlingPUSCH-Config-r17");
      dmrs_bundling_pusch_cfg_r17->to_json(j);
    }
    if (harq_process_num_size_dci_0_2_v1700_present) {
      j.write_int("harq-ProcessNumberSizeDCI-0-2-v1700", harq_process_num_size_dci_0_2_v1700);
    }
    if (harq_process_num_size_dci_0_1_r17_present) {
      j.write_int("harq-ProcessNumberSizeDCI-0-1-r17", harq_process_num_size_dci_0_1_r17);
    }
    if (mpe_res_pool_to_add_mod_list_r17.is_present()) {
      j.start_array("mpe-ResourcePoolToAddModList-r17");
      for (const auto& e1 : *mpe_res_pool_to_add_mod_list_r17) {
        e1.to_json(j);
      }
      j.end_array();
    }
    if (mpe_res_pool_to_release_list_r17.is_present()) {
      j.start_array("mpe-ResourcePoolToReleaseList-r17");
      for (const auto& e1 : *mpe_res_pool_to_release_list_r17) {
        j.write_int(e1);
      }
      j.end_array();
    }
  }
  j.end_obj();
}

const char* pusch_cfg_s::tx_cfg_opts::to_string() const
{
  static const char* names[] = {"codebook", "nonCodebook"};
  return convert_enum_idx(names, 2, value, "pusch_cfg_s::tx_cfg_e_");
}

const char* pusch_cfg_s::freq_hop_opts::to_string() const
{
  static const char* names[] = {"intraSlot", "interSlot"};
  return convert_enum_idx(names, 2, value, "pusch_cfg_s::freq_hop_e_");
}

const char* pusch_cfg_s::res_alloc_opts::to_string() const
{
  static const char* names[] = {"resourceAllocationType0", "resourceAllocationType1", "dynamicSwitch"};
  return convert_enum_idx(names, 3, value, "pusch_cfg_s::res_alloc_e_");
}
uint8_t pusch_cfg_s::res_alloc_opts::to_number() const
{
  static const uint8_t numbers[] = {0, 1};
  return map_enum_number(numbers, 2, value, "pusch_cfg_s::res_alloc_e_");
}

const char* pusch_cfg_s::pusch_aggregation_factor_opts::to_string() const
{
  static const char* names[] = {"n2", "n4", "n8"};
  return convert_enum_idx(names, 3, value, "pusch_cfg_s::pusch_aggregation_factor_e_");
}
uint8_t pusch_cfg_s::pusch_aggregation_factor_opts::to_number() const
{
  static const uint8_t numbers[] = {2, 4, 8};
  return map_enum_number(numbers, 3, value, "pusch_cfg_s::pusch_aggregation_factor_e_");
}

const char* pusch_cfg_s::mcs_table_opts::to_string() const
{
  static const char* names[] = {"qam256", "qam64LowSE"};
  return convert_enum_idx(names, 2, value, "pusch_cfg_s::mcs_table_e_");
}
uint16_t pusch_cfg_s::mcs_table_opts::to_number() const
{
  static const uint16_t numbers[] = {256, 64};
  return map_enum_number(numbers, 2, value, "pusch_cfg_s::mcs_table_e_");
}

const char* pusch_cfg_s::mcs_table_transform_precoder_opts::to_string() const
{
  static const char* names[] = {"qam256", "qam64LowSE"};
  return convert_enum_idx(names, 2, value, "pusch_cfg_s::mcs_table_transform_precoder_e_");
}
uint16_t pusch_cfg_s::mcs_table_transform_precoder_opts::to_number() const
{
  static const uint16_t numbers[] = {256, 64};
  return map_enum_number(numbers, 2, value, "pusch_cfg_s::mcs_table_transform_precoder_e_");
}

const char* pusch_cfg_s::transform_precoder_opts::to_string() const
{
  static const char* names[] = {"enabled", "disabled"};
  return convert_enum_idx(names, 2, value, "pusch_cfg_s::transform_precoder_e_");
}

const char* pusch_cfg_s::codebook_subset_opts::to_string() const
{
  static const char* names[] = {"fullyAndPartialAndNonCoherent", "partialAndNonCoherent", "nonCoherent"};
  return convert_enum_idx(names, 3, value, "pusch_cfg_s::codebook_subset_e_");
}

void pusch_cfg_s::freq_hop_dci_0_2_r16_c_::destroy_() {}
void pusch_cfg_s::freq_hop_dci_0_2_r16_c_::set(types::options e)
{
  destroy_();
  type_ = e;
}
pusch_cfg_s::freq_hop_dci_0_2_r16_c_::freq_hop_dci_0_2_r16_c_(const pusch_cfg_s::freq_hop_dci_0_2_r16_c_& other)
{
  type_ = other.type();
  switch (type_) {
    case types::pusch_rep_type_a:
      c.init(other.c.get<pusch_rep_type_a_e_>());
      break;
    case types::pusch_rep_type_b:
      c.init(other.c.get<pusch_rep_type_b_e_>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "pusch_cfg_s::freq_hop_dci_0_2_r16_c_");
  }
}
pusch_cfg_s::freq_hop_dci_0_2_r16_c_&
pusch_cfg_s::freq_hop_dci_0_2_r16_c_::operator=(const pusch_cfg_s::freq_hop_dci_0_2_r16_c_& other)
{
  if (this == &other) {
    return *this;
  }
  set(other.type());
  switch (type_) {
    case types::pusch_rep_type_a:
      c.set(other.c.get<pusch_rep_type_a_e_>());
      break;
    case types::pusch_rep_type_b:
      c.set(other.c.get<pusch_rep_type_b_e_>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "pusch_cfg_s::freq_hop_dci_0_2_r16_c_");
  }

  return *this;
}
pusch_cfg_s::freq_hop_dci_0_2_r16_c_::pusch_rep_type_a_e_& pusch_cfg_s::freq_hop_dci_0_2_r16_c_::set_pusch_rep_type_a()
{
  set(types::pusch_rep_type_a);
  return c.get<pusch_rep_type_a_e_>();
}
pusch_cfg_s::freq_hop_dci_0_2_r16_c_::pusch_rep_type_b_e_& pusch_cfg_s::freq_hop_dci_0_2_r16_c_::set_pusch_rep_type_b()
{
  set(types::pusch_rep_type_b);
  return c.get<pusch_rep_type_b_e_>();
}
void pusch_cfg_s::freq_hop_dci_0_2_r16_c_::to_json(json_writer& j) const
{
  j.start_obj();
  switch (type_) {
    case types::pusch_rep_type_a:
      j.write_str("pusch-RepTypeA", c.get<pusch_rep_type_a_e_>().to_string());
      break;
    case types::pusch_rep_type_b:
      j.write_str("pusch-RepTypeB", c.get<pusch_rep_type_b_e_>().to_string());
      break;
    default:
      log_invalid_choice_id(type_, "pusch_cfg_s::freq_hop_dci_0_2_r16_c_");
  }
  j.end_obj();
}
SRSASN_CODE pusch_cfg_s::freq_hop_dci_0_2_r16_c_::pack(bit_ref& bref) const
{
  type_.pack(bref);
  switch (type_) {
    case types::pusch_rep_type_a:
      HANDLE_CODE(c.get<pusch_rep_type_a_e_>().pack(bref));
      break;
    case types::pusch_rep_type_b:
      HANDLE_CODE(c.get<pusch_rep_type_b_e_>().pack(bref));
      break;
    default:
      log_invalid_choice_id(type_, "pusch_cfg_s::freq_hop_dci_0_2_r16_c_");
      return SRSASN_ERROR_ENCODE_FAIL;
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE pusch_cfg_s::freq_hop_dci_0_2_r16_c_::unpack(cbit_ref& bref)
{
  types e;
  e.unpack(bref);
  set(e);
  switch (type_) {
    case types::pusch_rep_type_a:
      HANDLE_CODE(c.get<pusch_rep_type_a_e_>().unpack(bref));
      break;
    case types::pusch_rep_type_b:
      HANDLE_CODE(c.get<pusch_rep_type_b_e_>().unpack(bref));
      break;
    default:
      log_invalid_choice_id(type_, "pusch_cfg_s::freq_hop_dci_0_2_r16_c_");
      return SRSASN_ERROR_DECODE_FAIL;
  }
  return SRSASN_SUCCESS;
}

const char* pusch_cfg_s::freq_hop_dci_0_2_r16_c_::pusch_rep_type_a_opts::to_string() const
{
  static const char* names[] = {"intraSlot", "interSlot"};
  return convert_enum_idx(names, 2, value, "pusch_cfg_s::freq_hop_dci_0_2_r16_c_::pusch_rep_type_a_e_");
}

const char* pusch_cfg_s::freq_hop_dci_0_2_r16_c_::pusch_rep_type_b_opts::to_string() const
{
  static const char* names[] = {"interRepetition", "interSlot"};
  return convert_enum_idx(names, 2, value, "pusch_cfg_s::freq_hop_dci_0_2_r16_c_::pusch_rep_type_b_e_");
}

const char* pusch_cfg_s::freq_hop_dci_0_2_r16_c_::types_opts::to_string() const
{
  static const char* names[] = {"pusch-RepTypeA", "pusch-RepTypeB"};
  return convert_enum_idx(names, 2, value, "pusch_cfg_s::freq_hop_dci_0_2_r16_c_::types");
}

const char* pusch_cfg_s::codebook_subset_dci_0_2_r16_opts::to_string() const
{
  static const char* names[] = {"fullyAndPartialAndNonCoherent", "partialAndNonCoherent", "nonCoherent"};
  return convert_enum_idx(names, 3, value, "pusch_cfg_s::codebook_subset_dci_0_2_r16_e_");
}

const char* pusch_cfg_s::mcs_table_dci_0_2_r16_opts::to_string() const
{
  static const char* names[] = {"qam256", "qam64LowSE"};
  return convert_enum_idx(names, 2, value, "pusch_cfg_s::mcs_table_dci_0_2_r16_e_");
}
uint16_t pusch_cfg_s::mcs_table_dci_0_2_r16_opts::to_number() const
{
  static const uint16_t numbers[] = {256, 64};
  return map_enum_number(numbers, 2, value, "pusch_cfg_s::mcs_table_dci_0_2_r16_e_");
}

const char* pusch_cfg_s::mcs_table_transform_precoder_dci_0_2_r16_opts::to_string() const
{
  static const char* names[] = {"qam256", "qam64LowSE"};
  return convert_enum_idx(names, 2, value, "pusch_cfg_s::mcs_table_transform_precoder_dci_0_2_r16_e_");
}
uint16_t pusch_cfg_s::mcs_table_transform_precoder_dci_0_2_r16_opts::to_number() const
{
  static const uint16_t numbers[] = {256, 64};
  return map_enum_number(numbers, 2, value, "pusch_cfg_s::mcs_table_transform_precoder_dci_0_2_r16_e_");
}

const char* pusch_cfg_s::pusch_rep_type_ind_dci_0_2_r16_opts::to_string() const
{
  static const char* names[] = {"pusch-RepTypeA", "pusch-RepTypeB"};
  return convert_enum_idx(names, 2, value, "pusch_cfg_s::pusch_rep_type_ind_dci_0_2_r16_e_");
}

const char* pusch_cfg_s::res_alloc_dci_0_2_r16_opts::to_string() const
{
  static const char* names[] = {"resourceAllocationType0", "resourceAllocationType1", "dynamicSwitch"};
  return convert_enum_idx(names, 3, value, "pusch_cfg_s::res_alloc_dci_0_2_r16_e_");
}
uint8_t pusch_cfg_s::res_alloc_dci_0_2_r16_opts::to_number() const
{
  static const uint8_t numbers[] = {0, 1};
  return map_enum_number(numbers, 2, value, "pusch_cfg_s::res_alloc_dci_0_2_r16_e_");
}

const char* pusch_cfg_s::res_alloc_type1_granularity_dci_0_2_r16_opts::to_string() const
{
  static const char* names[] = {"n2", "n4", "n8", "n16"};
  return convert_enum_idx(names, 4, value, "pusch_cfg_s::res_alloc_type1_granularity_dci_0_2_r16_e_");
}
uint8_t pusch_cfg_s::res_alloc_type1_granularity_dci_0_2_r16_opts::to_number() const
{
  static const uint8_t numbers[] = {2, 4, 8, 16};
  return map_enum_number(numbers, 4, value, "pusch_cfg_s::res_alloc_type1_granularity_dci_0_2_r16_e_");
}

const char* pusch_cfg_s::pusch_rep_type_ind_dci_0_1_r16_opts::to_string() const
{
  static const char* names[] = {"pusch-RepTypeA", "pusch-RepTypeB"};
  return convert_enum_idx(names, 2, value, "pusch_cfg_s::pusch_rep_type_ind_dci_0_1_r16_e_");
}

const char* pusch_cfg_s::freq_hop_dci_0_1_r16_opts::to_string() const
{
  static const char* names[] = {"interRepetition", "interSlot"};
  return convert_enum_idx(names, 2, value, "pusch_cfg_s::freq_hop_dci_0_1_r16_e_");
}

const char* pusch_cfg_s::ul_full_pwr_tx_r16_opts::to_string() const
{
  static const char* names[] = {"fullpower", "fullpowerMode1", "fullpowerMode2"};
  return convert_enum_idx(names, 3, value, "pusch_cfg_s::ul_full_pwr_tx_r16_e_");
}
uint8_t pusch_cfg_s::ul_full_pwr_tx_r16_opts::to_number() const
{
  switch (value) {
    case fullpwr_mode1:
      return 1;
    case fullpwr_mode2:
      return 2;
    default:
      invalid_enum_number(value, "pusch_cfg_s::ul_full_pwr_tx_r16_e_");
  }
  return 0;
}

const char* pusch_cfg_s::map_pattern_r17_opts::to_string() const
{
  static const char* names[] = {"cyclicMapping", "sequentialMapping"};
  return convert_enum_idx(names, 2, value, "pusch_cfg_s::map_pattern_r17_e_");
}

// PathlossReferenceRS-r17 ::= SEQUENCE
SRSASN_CODE pathloss_ref_rs_r17_s::pack(bit_ref& bref) const
{
  HANDLE_CODE(bref.pack(add_pci_r17_present, 1));

  HANDLE_CODE(pack_integer(bref, pathloss_ref_rs_id_r17, (uint8_t)0u, (uint8_t)63u));
  HANDLE_CODE(ref_sig_r17.pack(bref));
  if (add_pci_r17_present) {
    HANDLE_CODE(pack_integer(bref, add_pci_r17, (uint8_t)1u, (uint8_t)7u));
  }

  return SRSASN_SUCCESS;
}
SRSASN_CODE pathloss_ref_rs_r17_s::unpack(cbit_ref& bref)
{
  HANDLE_CODE(bref.unpack(add_pci_r17_present, 1));

  HANDLE_CODE(unpack_integer(pathloss_ref_rs_id_r17, bref, (uint8_t)0u, (uint8_t)63u));
  HANDLE_CODE(ref_sig_r17.unpack(bref));
  if (add_pci_r17_present) {
    HANDLE_CODE(unpack_integer(add_pci_r17, bref, (uint8_t)1u, (uint8_t)7u));
  }

  return SRSASN_SUCCESS;
}
void pathloss_ref_rs_r17_s::to_json(json_writer& j) const
{
  j.start_obj();
  j.write_int("pathlossReferenceRS-Id-r17", pathloss_ref_rs_id_r17);
  j.write_fieldname("referenceSignal-r17");
  ref_sig_r17.to_json(j);
  if (add_pci_r17_present) {
    j.write_int("additionalPCI-r17", add_pci_r17);
  }
  j.end_obj();
}

void pathloss_ref_rs_r17_s::ref_sig_r17_c_::destroy_() {}
void pathloss_ref_rs_r17_s::ref_sig_r17_c_::set(types::options e)
{
  destroy_();
  type_ = e;
}
pathloss_ref_rs_r17_s::ref_sig_r17_c_::ref_sig_r17_c_(const pathloss_ref_rs_r17_s::ref_sig_r17_c_& other)
{
  type_ = other.type();
  switch (type_) {
    case types::ssb_idx:
      c.init(other.c.get<uint8_t>());
      break;
    case types::csi_rs_idx:
      c.init(other.c.get<uint8_t>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "pathloss_ref_rs_r17_s::ref_sig_r17_c_");
  }
}
pathloss_ref_rs_r17_s::ref_sig_r17_c_&
pathloss_ref_rs_r17_s::ref_sig_r17_c_::operator=(const pathloss_ref_rs_r17_s::ref_sig_r17_c_& other)
{
  if (this == &other) {
    return *this;
  }
  set(other.type());
  switch (type_) {
    case types::ssb_idx:
      c.set(other.c.get<uint8_t>());
      break;
    case types::csi_rs_idx:
      c.set(other.c.get<uint8_t>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "pathloss_ref_rs_r17_s::ref_sig_r17_c_");
  }

  return *this;
}
uint8_t& pathloss_ref_rs_r17_s::ref_sig_r17_c_::set_ssb_idx()
{
  set(types::ssb_idx);
  return c.get<uint8_t>();
}
uint8_t& pathloss_ref_rs_r17_s::ref_sig_r17_c_::set_csi_rs_idx()
{
  set(types::csi_rs_idx);
  return c.get<uint8_t>();
}
void pathloss_ref_rs_r17_s::ref_sig_r17_c_::to_json(json_writer& j) const
{
  j.start_obj();
  switch (type_) {
    case types::ssb_idx:
      j.write_int("ssb-Index", c.get<uint8_t>());
      break;
    case types::csi_rs_idx:
      j.write_int("csi-RS-Index", c.get<uint8_t>());
      break;
    default:
      log_invalid_choice_id(type_, "pathloss_ref_rs_r17_s::ref_sig_r17_c_");
  }
  j.end_obj();
}
SRSASN_CODE pathloss_ref_rs_r17_s::ref_sig_r17_c_::pack(bit_ref& bref) const
{
  type_.pack(bref);
  switch (type_) {
    case types::ssb_idx:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)63u));
      break;
    case types::csi_rs_idx:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)191u));
      break;
    default:
      log_invalid_choice_id(type_, "pathloss_ref_rs_r17_s::ref_sig_r17_c_");
      return SRSASN_ERROR_ENCODE_FAIL;
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE pathloss_ref_rs_r17_s::ref_sig_r17_c_::unpack(cbit_ref& bref)
{
  types e;
  e.unpack(bref);
  set(e);
  switch (type_) {
    case types::ssb_idx:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)63u));
      break;
    case types::csi_rs_idx:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)191u));
      break;
    default:
      log_invalid_choice_id(type_, "pathloss_ref_rs_r17_s::ref_sig_r17_c_");
      return SRSASN_ERROR_DECODE_FAIL;
  }
  return SRSASN_SUCCESS;
}

const char* pathloss_ref_rs_r17_s::ref_sig_r17_c_::types_opts::to_string() const
{
  static const char* names[] = {"ssb-Index", "csi-RS-Index"};
  return convert_enum_idx(names, 2, value, "pathloss_ref_rs_r17_s::ref_sig_r17_c_::types");
}

// SRS-Config ::= SEQUENCE
SRSASN_CODE srs_cfg_s::pack(bit_ref& bref) const
{
  bref.pack(ext, 1);
  HANDLE_CODE(bref.pack(srs_res_set_to_release_list.size() > 0, 1));
  HANDLE_CODE(bref.pack(srs_res_set_to_add_mod_list.size() > 0, 1));
  HANDLE_CODE(bref.pack(srs_res_to_release_list.size() > 0, 1));
  HANDLE_CODE(bref.pack(srs_res_to_add_mod_list.size() > 0, 1));
  HANDLE_CODE(bref.pack(tpc_accumulation_present, 1));

  if (srs_res_set_to_release_list.size() > 0) {
    HANDLE_CODE(pack_dyn_seq_of(bref, srs_res_set_to_release_list, 1, 16, integer_packer<uint8_t>(0, 15)));
  }
  if (srs_res_set_to_add_mod_list.size() > 0) {
    HANDLE_CODE(pack_dyn_seq_of(bref, srs_res_set_to_add_mod_list, 1, 16));
  }
  if (srs_res_to_release_list.size() > 0) {
    HANDLE_CODE(pack_dyn_seq_of(bref, srs_res_to_release_list, 1, 64, integer_packer<uint8_t>(0, 63)));
  }
  if (srs_res_to_add_mod_list.size() > 0) {
    HANDLE_CODE(pack_dyn_seq_of(bref, srs_res_to_add_mod_list, 1, 64));
  }

  if (ext) {
    ext_groups_packer_guard group_flags;
    group_flags[0] |= srs_request_dci_1_2_r16_present;
    group_flags[0] |= srs_request_dci_0_2_r16_present;
    group_flags[0] |= srs_res_set_to_add_mod_list_dci_0_2_r16.is_present();
    group_flags[0] |= srs_res_set_to_release_list_dci_0_2_r16.is_present();
    group_flags[0] |= srs_pos_res_set_to_release_list_r16.is_present();
    group_flags[0] |= srs_pos_res_set_to_add_mod_list_r16.is_present();
    group_flags[0] |= srs_pos_res_to_release_list_r16.is_present();
    group_flags[0] |= srs_pos_res_to_add_mod_list_r16.is_present();
    group_flags.pack(bref);

    if (group_flags[0]) {
      varlength_field_pack_guard varlen_scope(bref, false);

      HANDLE_CODE(bref.pack(srs_request_dci_1_2_r16_present, 1));
      HANDLE_CODE(bref.pack(srs_request_dci_0_2_r16_present, 1));
      HANDLE_CODE(bref.pack(srs_res_set_to_add_mod_list_dci_0_2_r16.is_present(), 1));
      HANDLE_CODE(bref.pack(srs_res_set_to_release_list_dci_0_2_r16.is_present(), 1));
      HANDLE_CODE(bref.pack(srs_pos_res_set_to_release_list_r16.is_present(), 1));
      HANDLE_CODE(bref.pack(srs_pos_res_set_to_add_mod_list_r16.is_present(), 1));
      HANDLE_CODE(bref.pack(srs_pos_res_to_release_list_r16.is_present(), 1));
      HANDLE_CODE(bref.pack(srs_pos_res_to_add_mod_list_r16.is_present(), 1));
      if (srs_request_dci_1_2_r16_present) {
        HANDLE_CODE(pack_integer(bref, srs_request_dci_1_2_r16, (uint8_t)1u, (uint8_t)2u));
      }
      if (srs_request_dci_0_2_r16_present) {
        HANDLE_CODE(pack_integer(bref, srs_request_dci_0_2_r16, (uint8_t)1u, (uint8_t)2u));
      }
      if (srs_res_set_to_add_mod_list_dci_0_2_r16.is_present()) {
        HANDLE_CODE(pack_dyn_seq_of(bref, *srs_res_set_to_add_mod_list_dci_0_2_r16, 1, 16));
      }
      if (srs_res_set_to_release_list_dci_0_2_r16.is_present()) {
        HANDLE_CODE(
            pack_dyn_seq_of(bref, *srs_res_set_to_release_list_dci_0_2_r16, 1, 16, integer_packer<uint8_t>(0, 15)));
      }
      if (srs_pos_res_set_to_release_list_r16.is_present()) {
        HANDLE_CODE(pack_dyn_seq_of(bref, *srs_pos_res_set_to_release_list_r16, 1, 16, integer_packer<uint8_t>(0, 15)));
      }
      if (srs_pos_res_set_to_add_mod_list_r16.is_present()) {
        HANDLE_CODE(pack_dyn_seq_of(bref, *srs_pos_res_set_to_add_mod_list_r16, 1, 16));
      }
      if (srs_pos_res_to_release_list_r16.is_present()) {
        HANDLE_CODE(pack_dyn_seq_of(bref, *srs_pos_res_to_release_list_r16, 1, 64, integer_packer<uint8_t>(0, 63)));
      }
      if (srs_pos_res_to_add_mod_list_r16.is_present()) {
        HANDLE_CODE(pack_dyn_seq_of(bref, *srs_pos_res_to_add_mod_list_r16, 1, 64));
      }
    }
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE srs_cfg_s::unpack(cbit_ref& bref)
{
  bref.unpack(ext, 1);
  bool srs_res_set_to_release_list_present;
  HANDLE_CODE(bref.unpack(srs_res_set_to_release_list_present, 1));
  bool srs_res_set_to_add_mod_list_present;
  HANDLE_CODE(bref.unpack(srs_res_set_to_add_mod_list_present, 1));
  bool srs_res_to_release_list_present;
  HANDLE_CODE(bref.unpack(srs_res_to_release_list_present, 1));
  bool srs_res_to_add_mod_list_present;
  HANDLE_CODE(bref.unpack(srs_res_to_add_mod_list_present, 1));
  HANDLE_CODE(bref.unpack(tpc_accumulation_present, 1));

  if (srs_res_set_to_release_list_present) {
    HANDLE_CODE(unpack_dyn_seq_of(srs_res_set_to_release_list, bref, 1, 16, integer_packer<uint8_t>(0, 15)));
  }
  if (srs_res_set_to_add_mod_list_present) {
    HANDLE_CODE(unpack_dyn_seq_of(srs_res_set_to_add_mod_list, bref, 1, 16));
  }
  if (srs_res_to_release_list_present) {
    HANDLE_CODE(unpack_dyn_seq_of(srs_res_to_release_list, bref, 1, 64, integer_packer<uint8_t>(0, 63)));
  }
  if (srs_res_to_add_mod_list_present) {
    HANDLE_CODE(unpack_dyn_seq_of(srs_res_to_add_mod_list, bref, 1, 64));
  }

  if (ext) {
    ext_groups_unpacker_guard group_flags(1);
    group_flags.unpack(bref);

    if (group_flags[0]) {
      varlength_field_unpack_guard varlen_scope(bref, false);

      HANDLE_CODE(bref.unpack(srs_request_dci_1_2_r16_present, 1));
      HANDLE_CODE(bref.unpack(srs_request_dci_0_2_r16_present, 1));
      unpack_presence_flag(srs_res_set_to_add_mod_list_dci_0_2_r16, bref);
      unpack_presence_flag(srs_res_set_to_release_list_dci_0_2_r16, bref);
      unpack_presence_flag(srs_pos_res_set_to_release_list_r16, bref);
      unpack_presence_flag(srs_pos_res_set_to_add_mod_list_r16, bref);
      unpack_presence_flag(srs_pos_res_to_release_list_r16, bref);
      unpack_presence_flag(srs_pos_res_to_add_mod_list_r16, bref);
      if (srs_request_dci_1_2_r16_present) {
        HANDLE_CODE(unpack_integer(srs_request_dci_1_2_r16, bref, (uint8_t)1u, (uint8_t)2u));
      }
      if (srs_request_dci_0_2_r16_present) {
        HANDLE_CODE(unpack_integer(srs_request_dci_0_2_r16, bref, (uint8_t)1u, (uint8_t)2u));
      }
      if (srs_res_set_to_add_mod_list_dci_0_2_r16.is_present()) {
        HANDLE_CODE(unpack_dyn_seq_of(*srs_res_set_to_add_mod_list_dci_0_2_r16, bref, 1, 16));
      }
      if (srs_res_set_to_release_list_dci_0_2_r16.is_present()) {
        HANDLE_CODE(
            unpack_dyn_seq_of(*srs_res_set_to_release_list_dci_0_2_r16, bref, 1, 16, integer_packer<uint8_t>(0, 15)));
      }
      if (srs_pos_res_set_to_release_list_r16.is_present()) {
        HANDLE_CODE(
            unpack_dyn_seq_of(*srs_pos_res_set_to_release_list_r16, bref, 1, 16, integer_packer<uint8_t>(0, 15)));
      }
      if (srs_pos_res_set_to_add_mod_list_r16.is_present()) {
        HANDLE_CODE(unpack_dyn_seq_of(*srs_pos_res_set_to_add_mod_list_r16, bref, 1, 16));
      }
      if (srs_pos_res_to_release_list_r16.is_present()) {
        HANDLE_CODE(unpack_dyn_seq_of(*srs_pos_res_to_release_list_r16, bref, 1, 64, integer_packer<uint8_t>(0, 63)));
      }
      if (srs_pos_res_to_add_mod_list_r16.is_present()) {
        HANDLE_CODE(unpack_dyn_seq_of(*srs_pos_res_to_add_mod_list_r16, bref, 1, 64));
      }
    }
  }
  return SRSASN_SUCCESS;
}
void srs_cfg_s::to_json(json_writer& j) const
{
  j.start_obj();
  if (srs_res_set_to_release_list.size() > 0) {
    j.start_array("srs-ResourceSetToReleaseList");
    for (const auto& e1 : srs_res_set_to_release_list) {
      j.write_int(e1);
    }
    j.end_array();
  }
  if (srs_res_set_to_add_mod_list.size() > 0) {
    j.start_array("srs-ResourceSetToAddModList");
    for (const auto& e1 : srs_res_set_to_add_mod_list) {
      e1.to_json(j);
    }
    j.end_array();
  }
  if (srs_res_to_release_list.size() > 0) {
    j.start_array("srs-ResourceToReleaseList");
    for (const auto& e1 : srs_res_to_release_list) {
      j.write_int(e1);
    }
    j.end_array();
  }
  if (srs_res_to_add_mod_list.size() > 0) {
    j.start_array("srs-ResourceToAddModList");
    for (const auto& e1 : srs_res_to_add_mod_list) {
      e1.to_json(j);
    }
    j.end_array();
  }
  if (tpc_accumulation_present) {
    j.write_str("tpc-Accumulation", "disabled");
  }
  if (ext) {
    if (srs_request_dci_1_2_r16_present) {
      j.write_int("srs-RequestDCI-1-2-r16", srs_request_dci_1_2_r16);
    }
    if (srs_request_dci_0_2_r16_present) {
      j.write_int("srs-RequestDCI-0-2-r16", srs_request_dci_0_2_r16);
    }
    if (srs_res_set_to_add_mod_list_dci_0_2_r16.is_present()) {
      j.start_array("srs-ResourceSetToAddModListDCI-0-2-r16");
      for (const auto& e1 : *srs_res_set_to_add_mod_list_dci_0_2_r16) {
        e1.to_json(j);
      }
      j.end_array();
    }
    if (srs_res_set_to_release_list_dci_0_2_r16.is_present()) {
      j.start_array("srs-ResourceSetToReleaseListDCI-0-2-r16");
      for (const auto& e1 : *srs_res_set_to_release_list_dci_0_2_r16) {
        j.write_int(e1);
      }
      j.end_array();
    }
    if (srs_pos_res_set_to_release_list_r16.is_present()) {
      j.start_array("srs-PosResourceSetToReleaseList-r16");
      for (const auto& e1 : *srs_pos_res_set_to_release_list_r16) {
        j.write_int(e1);
      }
      j.end_array();
    }
    if (srs_pos_res_set_to_add_mod_list_r16.is_present()) {
      j.start_array("srs-PosResourceSetToAddModList-r16");
      for (const auto& e1 : *srs_pos_res_set_to_add_mod_list_r16) {
        e1.to_json(j);
      }
      j.end_array();
    }
    if (srs_pos_res_to_release_list_r16.is_present()) {
      j.start_array("srs-PosResourceToReleaseList-r16");
      for (const auto& e1 : *srs_pos_res_to_release_list_r16) {
        j.write_int(e1);
      }
      j.end_array();
    }
    if (srs_pos_res_to_add_mod_list_r16.is_present()) {
      j.start_array("srs-PosResourceToAddModList-r16");
      for (const auto& e1 : *srs_pos_res_to_add_mod_list_r16) {
        e1.to_json(j);
      }
      j.end_array();
    }
  }
  j.end_obj();
}

// TCI-UL-State-r17 ::= SEQUENCE
SRSASN_CODE tci_ul_state_r17_s::pack(bit_ref& bref) const
{
  bref.pack(ext, 1);
  HANDLE_CODE(bref.pack(serving_cell_id_r17_present, 1));
  HANDLE_CODE(bref.pack(bwp_id_r17_present, 1));
  HANDLE_CODE(bref.pack(add_pci_r17_present, 1));
  HANDLE_CODE(bref.pack(ul_pwr_ctrl_r17_present, 1));
  HANDLE_CODE(bref.pack(pathloss_ref_rs_id_r17_present, 1));

  HANDLE_CODE(pack_integer(bref, tci_ul_state_id_r17, (uint8_t)0u, (uint8_t)63u));
  if (serving_cell_id_r17_present) {
    HANDLE_CODE(pack_integer(bref, serving_cell_id_r17, (uint8_t)0u, (uint8_t)31u));
  }
  if (bwp_id_r17_present) {
    HANDLE_CODE(pack_integer(bref, bwp_id_r17, (uint8_t)0u, (uint8_t)4u));
  }
  HANDLE_CODE(ref_sig_r17.pack(bref));
  if (add_pci_r17_present) {
    HANDLE_CODE(pack_integer(bref, add_pci_r17, (uint8_t)1u, (uint8_t)7u));
  }
  if (ul_pwr_ctrl_r17_present) {
    HANDLE_CODE(pack_integer(bref, ul_pwr_ctrl_r17, (uint8_t)1u, (uint8_t)64u));
  }
  if (pathloss_ref_rs_id_r17_present) {
    HANDLE_CODE(pack_integer(bref, pathloss_ref_rs_id_r17, (uint8_t)0u, (uint8_t)63u));
  }

  return SRSASN_SUCCESS;
}
SRSASN_CODE tci_ul_state_r17_s::unpack(cbit_ref& bref)
{
  bref.unpack(ext, 1);
  HANDLE_CODE(bref.unpack(serving_cell_id_r17_present, 1));
  HANDLE_CODE(bref.unpack(bwp_id_r17_present, 1));
  HANDLE_CODE(bref.unpack(add_pci_r17_present, 1));
  HANDLE_CODE(bref.unpack(ul_pwr_ctrl_r17_present, 1));
  HANDLE_CODE(bref.unpack(pathloss_ref_rs_id_r17_present, 1));

  HANDLE_CODE(unpack_integer(tci_ul_state_id_r17, bref, (uint8_t)0u, (uint8_t)63u));
  if (serving_cell_id_r17_present) {
    HANDLE_CODE(unpack_integer(serving_cell_id_r17, bref, (uint8_t)0u, (uint8_t)31u));
  }
  if (bwp_id_r17_present) {
    HANDLE_CODE(unpack_integer(bwp_id_r17, bref, (uint8_t)0u, (uint8_t)4u));
  }
  HANDLE_CODE(ref_sig_r17.unpack(bref));
  if (add_pci_r17_present) {
    HANDLE_CODE(unpack_integer(add_pci_r17, bref, (uint8_t)1u, (uint8_t)7u));
  }
  if (ul_pwr_ctrl_r17_present) {
    HANDLE_CODE(unpack_integer(ul_pwr_ctrl_r17, bref, (uint8_t)1u, (uint8_t)64u));
  }
  if (pathloss_ref_rs_id_r17_present) {
    HANDLE_CODE(unpack_integer(pathloss_ref_rs_id_r17, bref, (uint8_t)0u, (uint8_t)63u));
  }

  return SRSASN_SUCCESS;
}
void tci_ul_state_r17_s::to_json(json_writer& j) const
{
  j.start_obj();
  j.write_int("tci-UL-StateId-r17", tci_ul_state_id_r17);
  if (serving_cell_id_r17_present) {
    j.write_int("servingCellId-r17", serving_cell_id_r17);
  }
  if (bwp_id_r17_present) {
    j.write_int("bwp-Id-r17", bwp_id_r17);
  }
  j.write_fieldname("referenceSignal-r17");
  ref_sig_r17.to_json(j);
  if (add_pci_r17_present) {
    j.write_int("additionalPCI-r17", add_pci_r17);
  }
  if (ul_pwr_ctrl_r17_present) {
    j.write_int("ul-powerControl-r17", ul_pwr_ctrl_r17);
  }
  if (pathloss_ref_rs_id_r17_present) {
    j.write_int("pathlossReferenceRS-Id-r17", pathloss_ref_rs_id_r17);
  }
  j.end_obj();
}

void tci_ul_state_r17_s::ref_sig_r17_c_::destroy_() {}
void tci_ul_state_r17_s::ref_sig_r17_c_::set(types::options e)
{
  destroy_();
  type_ = e;
}
tci_ul_state_r17_s::ref_sig_r17_c_::ref_sig_r17_c_(const tci_ul_state_r17_s::ref_sig_r17_c_& other)
{
  type_ = other.type();
  switch (type_) {
    case types::ssb_idx_r17:
      c.init(other.c.get<uint8_t>());
      break;
    case types::csi_rs_idx_r17:
      c.init(other.c.get<uint8_t>());
      break;
    case types::srs_r17:
      c.init(other.c.get<uint8_t>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "tci_ul_state_r17_s::ref_sig_r17_c_");
  }
}
tci_ul_state_r17_s::ref_sig_r17_c_&
tci_ul_state_r17_s::ref_sig_r17_c_::operator=(const tci_ul_state_r17_s::ref_sig_r17_c_& other)
{
  if (this == &other) {
    return *this;
  }
  set(other.type());
  switch (type_) {
    case types::ssb_idx_r17:
      c.set(other.c.get<uint8_t>());
      break;
    case types::csi_rs_idx_r17:
      c.set(other.c.get<uint8_t>());
      break;
    case types::srs_r17:
      c.set(other.c.get<uint8_t>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "tci_ul_state_r17_s::ref_sig_r17_c_");
  }

  return *this;
}
uint8_t& tci_ul_state_r17_s::ref_sig_r17_c_::set_ssb_idx_r17()
{
  set(types::ssb_idx_r17);
  return c.get<uint8_t>();
}
uint8_t& tci_ul_state_r17_s::ref_sig_r17_c_::set_csi_rs_idx_r17()
{
  set(types::csi_rs_idx_r17);
  return c.get<uint8_t>();
}
uint8_t& tci_ul_state_r17_s::ref_sig_r17_c_::set_srs_r17()
{
  set(types::srs_r17);
  return c.get<uint8_t>();
}
void tci_ul_state_r17_s::ref_sig_r17_c_::to_json(json_writer& j) const
{
  j.start_obj();
  switch (type_) {
    case types::ssb_idx_r17:
      j.write_int("ssb-Index-r17", c.get<uint8_t>());
      break;
    case types::csi_rs_idx_r17:
      j.write_int("csi-RS-Index-r17", c.get<uint8_t>());
      break;
    case types::srs_r17:
      j.write_int("srs-r17", c.get<uint8_t>());
      break;
    default:
      log_invalid_choice_id(type_, "tci_ul_state_r17_s::ref_sig_r17_c_");
  }
  j.end_obj();
}
SRSASN_CODE tci_ul_state_r17_s::ref_sig_r17_c_::pack(bit_ref& bref) const
{
  type_.pack(bref);
  switch (type_) {
    case types::ssb_idx_r17:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)63u));
      break;
    case types::csi_rs_idx_r17:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)191u));
      break;
    case types::srs_r17:
      HANDLE_CODE(pack_integer(bref, c.get<uint8_t>(), (uint8_t)0u, (uint8_t)63u));
      break;
    default:
      log_invalid_choice_id(type_, "tci_ul_state_r17_s::ref_sig_r17_c_");
      return SRSASN_ERROR_ENCODE_FAIL;
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE tci_ul_state_r17_s::ref_sig_r17_c_::unpack(cbit_ref& bref)
{
  types e;
  e.unpack(bref);
  set(e);
  switch (type_) {
    case types::ssb_idx_r17:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)63u));
      break;
    case types::csi_rs_idx_r17:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)191u));
      break;
    case types::srs_r17:
      HANDLE_CODE(unpack_integer(c.get<uint8_t>(), bref, (uint8_t)0u, (uint8_t)63u));
      break;
    default:
      log_invalid_choice_id(type_, "tci_ul_state_r17_s::ref_sig_r17_c_");
      return SRSASN_ERROR_DECODE_FAIL;
  }
  return SRSASN_SUCCESS;
}

const char* tci_ul_state_r17_s::ref_sig_r17_c_::types_opts::to_string() const
{
  static const char* names[] = {"ssb-Index-r17", "csi-RS-Index-r17", "srs-r17"};
  return convert_enum_idx(names, 3, value, "tci_ul_state_r17_s::ref_sig_r17_c_::types");
}

// BWP-UplinkDedicated ::= SEQUENCE
SRSASN_CODE bwp_ul_ded_s::pack(bit_ref& bref) const
{
  bref.pack(ext, 1);
  HANDLE_CODE(bref.pack(pucch_cfg_present, 1));
  HANDLE_CODE(bref.pack(pusch_cfg_present, 1));
  HANDLE_CODE(bref.pack(cfg_grant_cfg_present, 1));
  HANDLE_CODE(bref.pack(srs_cfg_present, 1));
  HANDLE_CODE(bref.pack(beam_fail_recovery_cfg_present, 1));

  if (pucch_cfg_present) {
    HANDLE_CODE(pucch_cfg.pack(bref));
  }
  if (pusch_cfg_present) {
    HANDLE_CODE(pusch_cfg.pack(bref));
  }
  if (cfg_grant_cfg_present) {
    HANDLE_CODE(cfg_grant_cfg.pack(bref));
  }
  if (srs_cfg_present) {
    HANDLE_CODE(srs_cfg.pack(bref));
  }
  if (beam_fail_recovery_cfg_present) {
    HANDLE_CODE(beam_fail_recovery_cfg.pack(bref));
  }

  if (ext) {
    ext_groups_packer_guard group_flags;
    group_flags[0] |= sl_pucch_cfg_r16.is_present();
    group_flags[0] |= cp_ext_c2_r16_present;
    group_flags[0] |= cp_ext_c3_r16_present;
    group_flags[0] |= use_interlace_pucch_pusch_r16_present;
    group_flags[0] |= pucch_cfg_list_r16.is_present();
    group_flags[0] |= lbt_fail_recovery_cfg_r16.is_present();
    group_flags[0] |= cfg_grant_cfg_to_add_mod_list_r16.is_present();
    group_flags[0] |= cfg_grant_cfg_to_release_list_r16.is_present();
    group_flags[0] |= cfg_grant_cfg_type2_deactivation_state_list_r16.is_present();
    group_flags[1] |= ul_tci_state_list_r17.is_present();
    group_flags[1] |= ul_pwr_ctrl_r17_present;
    group_flags[1] |= pucch_cfg_list_multicast1_r17.is_present();
    group_flags[1] |= pucch_cfg_list_multicast2_r17.is_present();
    group_flags[2] |= pucch_cfg_multicast1_r17.is_present();
    group_flags[2] |= pucch_cfg_multicast2_r17.is_present();
    group_flags[3] |= pathloss_ref_rs_to_add_mod_list_r17.is_present();
    group_flags[3] |= pathloss_ref_rs_to_release_list_r17.is_present();
    group_flags.pack(bref);

    if (group_flags[0]) {
      varlength_field_pack_guard varlen_scope(bref, false);

      HANDLE_CODE(bref.pack(sl_pucch_cfg_r16.is_present(), 1));
      HANDLE_CODE(bref.pack(cp_ext_c2_r16_present, 1));
      HANDLE_CODE(bref.pack(cp_ext_c3_r16_present, 1));
      HANDLE_CODE(bref.pack(use_interlace_pucch_pusch_r16_present, 1));
      HANDLE_CODE(bref.pack(pucch_cfg_list_r16.is_present(), 1));
      HANDLE_CODE(bref.pack(lbt_fail_recovery_cfg_r16.is_present(), 1));
      HANDLE_CODE(bref.pack(cfg_grant_cfg_to_add_mod_list_r16.is_present(), 1));
      HANDLE_CODE(bref.pack(cfg_grant_cfg_to_release_list_r16.is_present(), 1));
      HANDLE_CODE(bref.pack(cfg_grant_cfg_type2_deactivation_state_list_r16.is_present(), 1));
      if (sl_pucch_cfg_r16.is_present()) {
        HANDLE_CODE(sl_pucch_cfg_r16->pack(bref));
      }
      if (cp_ext_c2_r16_present) {
        HANDLE_CODE(pack_integer(bref, cp_ext_c2_r16, (uint8_t)1u, (uint8_t)28u));
      }
      if (cp_ext_c3_r16_present) {
        HANDLE_CODE(pack_integer(bref, cp_ext_c3_r16, (uint8_t)1u, (uint8_t)28u));
      }
      if (pucch_cfg_list_r16.is_present()) {
        HANDLE_CODE(pucch_cfg_list_r16->pack(bref));
      }
      if (lbt_fail_recovery_cfg_r16.is_present()) {
        HANDLE_CODE(lbt_fail_recovery_cfg_r16->pack(bref));
      }
      if (cfg_grant_cfg_to_add_mod_list_r16.is_present()) {
        HANDLE_CODE(pack_dyn_seq_of(bref, *cfg_grant_cfg_to_add_mod_list_r16, 1, 12));
      }
      if (cfg_grant_cfg_to_release_list_r16.is_present()) {
        HANDLE_CODE(pack_dyn_seq_of(bref, *cfg_grant_cfg_to_release_list_r16, 1, 12, integer_packer<uint8_t>(0, 11)));
      }
      if (cfg_grant_cfg_type2_deactivation_state_list_r16.is_present()) {
        HANDLE_CODE(pack_dyn_seq_of(bref,
                                    *cfg_grant_cfg_type2_deactivation_state_list_r16,
                                    1,
                                    16,
                                    SeqOfPacker<integer_packer<uint8_t>>(1, 12, integer_packer<uint8_t>(0, 11))));
      }
    }
    if (group_flags[1]) {
      varlength_field_pack_guard varlen_scope(bref, false);

      HANDLE_CODE(bref.pack(ul_tci_state_list_r17.is_present(), 1));
      HANDLE_CODE(bref.pack(ul_pwr_ctrl_r17_present, 1));
      HANDLE_CODE(bref.pack(pucch_cfg_list_multicast1_r17.is_present(), 1));
      HANDLE_CODE(bref.pack(pucch_cfg_list_multicast2_r17.is_present(), 1));
      if (ul_tci_state_list_r17.is_present()) {
        HANDLE_CODE(ul_tci_state_list_r17->pack(bref));
      }
      if (ul_pwr_ctrl_r17_present) {
        HANDLE_CODE(pack_integer(bref, ul_pwr_ctrl_r17, (uint8_t)1u, (uint8_t)64u));
      }
      if (pucch_cfg_list_multicast1_r17.is_present()) {
        HANDLE_CODE(pucch_cfg_list_multicast1_r17->pack(bref));
      }
      if (pucch_cfg_list_multicast2_r17.is_present()) {
        HANDLE_CODE(pucch_cfg_list_multicast2_r17->pack(bref));
      }
    }
    if (group_flags[2]) {
      varlength_field_pack_guard varlen_scope(bref, false);

      HANDLE_CODE(bref.pack(pucch_cfg_multicast1_r17.is_present(), 1));
      HANDLE_CODE(bref.pack(pucch_cfg_multicast2_r17.is_present(), 1));
      if (pucch_cfg_multicast1_r17.is_present()) {
        HANDLE_CODE(pucch_cfg_multicast1_r17->pack(bref));
      }
      if (pucch_cfg_multicast2_r17.is_present()) {
        HANDLE_CODE(pucch_cfg_multicast2_r17->pack(bref));
      }
    }
    if (group_flags[3]) {
      varlength_field_pack_guard varlen_scope(bref, false);

      HANDLE_CODE(bref.pack(pathloss_ref_rs_to_add_mod_list_r17.is_present(), 1));
      HANDLE_CODE(bref.pack(pathloss_ref_rs_to_release_list_r17.is_present(), 1));
      if (pathloss_ref_rs_to_add_mod_list_r17.is_present()) {
        HANDLE_CODE(pack_dyn_seq_of(bref, *pathloss_ref_rs_to_add_mod_list_r17, 1, 64));
      }
      if (pathloss_ref_rs_to_release_list_r17.is_present()) {
        HANDLE_CODE(pack_dyn_seq_of(bref, *pathloss_ref_rs_to_release_list_r17, 1, 64, integer_packer<uint8_t>(0, 63)));
      }
    }
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE bwp_ul_ded_s::unpack(cbit_ref& bref)
{
  bref.unpack(ext, 1);
  HANDLE_CODE(bref.unpack(pucch_cfg_present, 1));
  HANDLE_CODE(bref.unpack(pusch_cfg_present, 1));
  HANDLE_CODE(bref.unpack(cfg_grant_cfg_present, 1));
  HANDLE_CODE(bref.unpack(srs_cfg_present, 1));
  HANDLE_CODE(bref.unpack(beam_fail_recovery_cfg_present, 1));

  if (pucch_cfg_present) {
    HANDLE_CODE(pucch_cfg.unpack(bref));
  }
  if (pusch_cfg_present) {
    HANDLE_CODE(pusch_cfg.unpack(bref));
  }
  if (cfg_grant_cfg_present) {
    HANDLE_CODE(cfg_grant_cfg.unpack(bref));
  }
  if (srs_cfg_present) {
    HANDLE_CODE(srs_cfg.unpack(bref));
  }
  if (beam_fail_recovery_cfg_present) {
    HANDLE_CODE(beam_fail_recovery_cfg.unpack(bref));
  }

  if (ext) {
    ext_groups_unpacker_guard group_flags(4);
    group_flags.unpack(bref);

    if (group_flags[0]) {
      varlength_field_unpack_guard varlen_scope(bref, false);

      unpack_presence_flag(sl_pucch_cfg_r16, bref);
      HANDLE_CODE(bref.unpack(cp_ext_c2_r16_present, 1));
      HANDLE_CODE(bref.unpack(cp_ext_c3_r16_present, 1));
      HANDLE_CODE(bref.unpack(use_interlace_pucch_pusch_r16_present, 1));
      unpack_presence_flag(pucch_cfg_list_r16, bref);
      unpack_presence_flag(lbt_fail_recovery_cfg_r16, bref);
      unpack_presence_flag(cfg_grant_cfg_to_add_mod_list_r16, bref);
      unpack_presence_flag(cfg_grant_cfg_to_release_list_r16, bref);
      unpack_presence_flag(cfg_grant_cfg_type2_deactivation_state_list_r16, bref);
      if (sl_pucch_cfg_r16.is_present()) {
        HANDLE_CODE(sl_pucch_cfg_r16->unpack(bref));
      }
      if (cp_ext_c2_r16_present) {
        HANDLE_CODE(unpack_integer(cp_ext_c2_r16, bref, (uint8_t)1u, (uint8_t)28u));
      }
      if (cp_ext_c3_r16_present) {
        HANDLE_CODE(unpack_integer(cp_ext_c3_r16, bref, (uint8_t)1u, (uint8_t)28u));
      }
      if (pucch_cfg_list_r16.is_present()) {
        HANDLE_CODE(pucch_cfg_list_r16->unpack(bref));
      }
      if (lbt_fail_recovery_cfg_r16.is_present()) {
        HANDLE_CODE(lbt_fail_recovery_cfg_r16->unpack(bref));
      }
      if (cfg_grant_cfg_to_add_mod_list_r16.is_present()) {
        HANDLE_CODE(unpack_dyn_seq_of(*cfg_grant_cfg_to_add_mod_list_r16, bref, 1, 12));
      }
      if (cfg_grant_cfg_to_release_list_r16.is_present()) {
        HANDLE_CODE(unpack_dyn_seq_of(*cfg_grant_cfg_to_release_list_r16, bref, 1, 12, integer_packer<uint8_t>(0, 11)));
      }
      if (cfg_grant_cfg_type2_deactivation_state_list_r16.is_present()) {
        HANDLE_CODE(unpack_dyn_seq_of(*cfg_grant_cfg_type2_deactivation_state_list_r16,
                                      bref,
                                      1,
                                      16,
                                      SeqOfPacker<integer_packer<uint8_t>>(1, 12, integer_packer<uint8_t>(0, 11))));
      }
    }
    if (group_flags[1]) {
      varlength_field_unpack_guard varlen_scope(bref, false);

      unpack_presence_flag(ul_tci_state_list_r17, bref);
      HANDLE_CODE(bref.unpack(ul_pwr_ctrl_r17_present, 1));
      unpack_presence_flag(pucch_cfg_list_multicast1_r17, bref);
      unpack_presence_flag(pucch_cfg_list_multicast2_r17, bref);
      if (ul_tci_state_list_r17.is_present()) {
        HANDLE_CODE(ul_tci_state_list_r17->unpack(bref));
      }
      if (ul_pwr_ctrl_r17_present) {
        HANDLE_CODE(unpack_integer(ul_pwr_ctrl_r17, bref, (uint8_t)1u, (uint8_t)64u));
      }
      if (pucch_cfg_list_multicast1_r17.is_present()) {
        HANDLE_CODE(pucch_cfg_list_multicast1_r17->unpack(bref));
      }
      if (pucch_cfg_list_multicast2_r17.is_present()) {
        HANDLE_CODE(pucch_cfg_list_multicast2_r17->unpack(bref));
      }
    }
    if (group_flags[2]) {
      varlength_field_unpack_guard varlen_scope(bref, false);

      unpack_presence_flag(pucch_cfg_multicast1_r17, bref);
      unpack_presence_flag(pucch_cfg_multicast2_r17, bref);
      if (pucch_cfg_multicast1_r17.is_present()) {
        HANDLE_CODE(pucch_cfg_multicast1_r17->unpack(bref));
      }
      if (pucch_cfg_multicast2_r17.is_present()) {
        HANDLE_CODE(pucch_cfg_multicast2_r17->unpack(bref));
      }
    }
    if (group_flags[3]) {
      varlength_field_unpack_guard varlen_scope(bref, false);

      unpack_presence_flag(pathloss_ref_rs_to_add_mod_list_r17, bref);
      unpack_presence_flag(pathloss_ref_rs_to_release_list_r17, bref);
      if (pathloss_ref_rs_to_add_mod_list_r17.is_present()) {
        HANDLE_CODE(unpack_dyn_seq_of(*pathloss_ref_rs_to_add_mod_list_r17, bref, 1, 64));
      }
      if (pathloss_ref_rs_to_release_list_r17.is_present()) {
        HANDLE_CODE(
            unpack_dyn_seq_of(*pathloss_ref_rs_to_release_list_r17, bref, 1, 64, integer_packer<uint8_t>(0, 63)));
      }
    }
  }
  return SRSASN_SUCCESS;
}
void bwp_ul_ded_s::to_json(json_writer& j) const
{
  j.start_obj();
  if (pucch_cfg_present) {
    j.write_fieldname("pucch-Config");
    pucch_cfg.to_json(j);
  }
  if (pusch_cfg_present) {
    j.write_fieldname("pusch-Config");
    pusch_cfg.to_json(j);
  }
  if (cfg_grant_cfg_present) {
    j.write_fieldname("configuredGrantConfig");
    cfg_grant_cfg.to_json(j);
  }
  if (srs_cfg_present) {
    j.write_fieldname("srs-Config");
    srs_cfg.to_json(j);
  }
  if (beam_fail_recovery_cfg_present) {
    j.write_fieldname("beamFailureRecoveryConfig");
    beam_fail_recovery_cfg.to_json(j);
  }
  if (ext) {
    if (sl_pucch_cfg_r16.is_present()) {
      j.write_fieldname("sl-PUCCH-Config-r16");
      sl_pucch_cfg_r16->to_json(j);
    }
    if (cp_ext_c2_r16_present) {
      j.write_int("cp-ExtensionC2-r16", cp_ext_c2_r16);
    }
    if (cp_ext_c3_r16_present) {
      j.write_int("cp-ExtensionC3-r16", cp_ext_c3_r16);
    }
    if (use_interlace_pucch_pusch_r16_present) {
      j.write_str("useInterlacePUCCH-PUSCH-r16", "enabled");
    }
    if (pucch_cfg_list_r16.is_present()) {
      j.write_fieldname("pucch-ConfigurationList-r16");
      pucch_cfg_list_r16->to_json(j);
    }
    if (lbt_fail_recovery_cfg_r16.is_present()) {
      j.write_fieldname("lbt-FailureRecoveryConfig-r16");
      lbt_fail_recovery_cfg_r16->to_json(j);
    }
    if (cfg_grant_cfg_to_add_mod_list_r16.is_present()) {
      j.start_array("configuredGrantConfigToAddModList-r16");
      for (const auto& e1 : *cfg_grant_cfg_to_add_mod_list_r16) {
        e1.to_json(j);
      }
      j.end_array();
    }
    if (cfg_grant_cfg_to_release_list_r16.is_present()) {
      j.start_array("configuredGrantConfigToReleaseList-r16");
      for (const auto& e1 : *cfg_grant_cfg_to_release_list_r16) {
        j.write_int(e1);
      }
      j.end_array();
    }
    if (cfg_grant_cfg_type2_deactivation_state_list_r16.is_present()) {
      j.start_array("configuredGrantConfigType2DeactivationStateList-r16");
      for (const auto& e1 : *cfg_grant_cfg_type2_deactivation_state_list_r16) {
        j.start_array();
        for (const auto& e2 : e1) {
          j.write_int(e2);
        }
        j.end_array();
      }
      j.end_array();
    }
    if (ul_tci_state_list_r17.is_present()) {
      j.write_fieldname("ul-TCI-StateList-r17");
      ul_tci_state_list_r17->to_json(j);
    }
    if (ul_pwr_ctrl_r17_present) {
      j.write_int("ul-powerControl-r17", ul_pwr_ctrl_r17);
    }
    if (pucch_cfg_list_multicast1_r17.is_present()) {
      j.write_fieldname("pucch-ConfigurationListMulticast1-r17");
      pucch_cfg_list_multicast1_r17->to_json(j);
    }
    if (pucch_cfg_list_multicast2_r17.is_present()) {
      j.write_fieldname("pucch-ConfigurationListMulticast2-r17");
      pucch_cfg_list_multicast2_r17->to_json(j);
    }
    if (pucch_cfg_multicast1_r17.is_present()) {
      j.write_fieldname("pucch-ConfigMulticast1-r17");
      pucch_cfg_multicast1_r17->to_json(j);
    }
    if (pucch_cfg_multicast2_r17.is_present()) {
      j.write_fieldname("pucch-ConfigMulticast2-r17");
      pucch_cfg_multicast2_r17->to_json(j);
    }
    if (pathloss_ref_rs_to_add_mod_list_r17.is_present()) {
      j.start_array("pathlossReferenceRSToAddModList-r17");
      for (const auto& e1 : *pathloss_ref_rs_to_add_mod_list_r17) {
        e1.to_json(j);
      }
      j.end_array();
    }
    if (pathloss_ref_rs_to_release_list_r17.is_present()) {
      j.start_array("pathlossReferenceRSToReleaseList-r17");
      for (const auto& e1 : *pathloss_ref_rs_to_release_list_r17) {
        j.write_int(e1);
      }
      j.end_array();
    }
  }
  j.end_obj();
}

void bwp_ul_ded_s::ul_tci_state_list_r17_c_::destroy_()
{
  switch (type_) {
    case types::explicitlist:
      c.destroy<explicitlist_s_>();
      break;
    case types::unified_tci_state_ref_r17:
      c.destroy<serving_cell_and_bwp_id_r17_s>();
      break;
    default:
      break;
  }
}
void bwp_ul_ded_s::ul_tci_state_list_r17_c_::set(types::options e)
{
  destroy_();
  type_ = e;
  switch (type_) {
    case types::explicitlist:
      c.init<explicitlist_s_>();
      break;
    case types::unified_tci_state_ref_r17:
      c.init<serving_cell_and_bwp_id_r17_s>();
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "bwp_ul_ded_s::ul_tci_state_list_r17_c_");
  }
}
bwp_ul_ded_s::ul_tci_state_list_r17_c_::ul_tci_state_list_r17_c_(const bwp_ul_ded_s::ul_tci_state_list_r17_c_& other)
{
  type_ = other.type();
  switch (type_) {
    case types::explicitlist:
      c.init(other.c.get<explicitlist_s_>());
      break;
    case types::unified_tci_state_ref_r17:
      c.init(other.c.get<serving_cell_and_bwp_id_r17_s>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "bwp_ul_ded_s::ul_tci_state_list_r17_c_");
  }
}
bwp_ul_ded_s::ul_tci_state_list_r17_c_&
bwp_ul_ded_s::ul_tci_state_list_r17_c_::operator=(const bwp_ul_ded_s::ul_tci_state_list_r17_c_& other)
{
  if (this == &other) {
    return *this;
  }
  set(other.type());
  switch (type_) {
    case types::explicitlist:
      c.set(other.c.get<explicitlist_s_>());
      break;
    case types::unified_tci_state_ref_r17:
      c.set(other.c.get<serving_cell_and_bwp_id_r17_s>());
      break;
    case types::nulltype:
      break;
    default:
      log_invalid_choice_id(type_, "bwp_ul_ded_s::ul_tci_state_list_r17_c_");
  }

  return *this;
}
bwp_ul_ded_s::ul_tci_state_list_r17_c_::explicitlist_s_& bwp_ul_ded_s::ul_tci_state_list_r17_c_::set_explicitlist()
{
  set(types::explicitlist);
  return c.get<explicitlist_s_>();
}
serving_cell_and_bwp_id_r17_s& bwp_ul_ded_s::ul_tci_state_list_r17_c_::set_unified_tci_state_ref_r17()
{
  set(types::unified_tci_state_ref_r17);
  return c.get<serving_cell_and_bwp_id_r17_s>();
}
void bwp_ul_ded_s::ul_tci_state_list_r17_c_::to_json(json_writer& j) const
{
  j.start_obj();
  switch (type_) {
    case types::explicitlist:
      j.write_fieldname("explicitlist");
      j.start_obj();
      if (c.get<explicitlist_s_>().ul_tci_to_add_mod_list_r17.size() > 0) {
        j.start_array("ul-TCI-ToAddModList-r17");
        for (const auto& e1 : c.get<explicitlist_s_>().ul_tci_to_add_mod_list_r17) {
          e1.to_json(j);
        }
        j.end_array();
      }
      if (c.get<explicitlist_s_>().ul_tci_to_release_list_r17.size() > 0) {
        j.start_array("ul-TCI-ToReleaseList-r17");
        for (const auto& e1 : c.get<explicitlist_s_>().ul_tci_to_release_list_r17) {
          j.write_int(e1);
        }
        j.end_array();
      }
      j.end_obj();
      break;
    case types::unified_tci_state_ref_r17:
      j.write_fieldname("unifiedTCI-StateRef-r17");
      c.get<serving_cell_and_bwp_id_r17_s>().to_json(j);
      break;
    default:
      log_invalid_choice_id(type_, "bwp_ul_ded_s::ul_tci_state_list_r17_c_");
  }
  j.end_obj();
}
SRSASN_CODE bwp_ul_ded_s::ul_tci_state_list_r17_c_::pack(bit_ref& bref) const
{
  type_.pack(bref);
  switch (type_) {
    case types::explicitlist:
      HANDLE_CODE(bref.pack(c.get<explicitlist_s_>().ul_tci_to_add_mod_list_r17.size() > 0, 1));
      HANDLE_CODE(bref.pack(c.get<explicitlist_s_>().ul_tci_to_release_list_r17.size() > 0, 1));
      if (c.get<explicitlist_s_>().ul_tci_to_add_mod_list_r17.size() > 0) {
        HANDLE_CODE(pack_dyn_seq_of(bref, c.get<explicitlist_s_>().ul_tci_to_add_mod_list_r17, 1, 64));
      }
      if (c.get<explicitlist_s_>().ul_tci_to_release_list_r17.size() > 0) {
        HANDLE_CODE(pack_dyn_seq_of(
            bref, c.get<explicitlist_s_>().ul_tci_to_release_list_r17, 1, 64, integer_packer<uint8_t>(0, 63)));
      }
      break;
    case types::unified_tci_state_ref_r17:
      HANDLE_CODE(c.get<serving_cell_and_bwp_id_r17_s>().pack(bref));
      break;
    default:
      log_invalid_choice_id(type_, "bwp_ul_ded_s::ul_tci_state_list_r17_c_");
      return SRSASN_ERROR_ENCODE_FAIL;
  }
  return SRSASN_SUCCESS;
}
SRSASN_CODE bwp_ul_ded_s::ul_tci_state_list_r17_c_::unpack(cbit_ref& bref)
{
  types e;
  e.unpack(bref);
  set(e);
  switch (type_) {
    case types::explicitlist:
      bool ul_tci_to_add_mod_list_r17_present;
      HANDLE_CODE(bref.unpack(ul_tci_to_add_mod_list_r17_present, 1));
      bool ul_tci_to_release_list_r17_present;
      HANDLE_CODE(bref.unpack(ul_tci_to_release_list_r17_present, 1));
      if (ul_tci_to_add_mod_list_r17_present) {
        HANDLE_CODE(unpack_dyn_seq_of(c.get<explicitlist_s_>().ul_tci_to_add_mod_list_r17, bref, 1, 64));
      }
      if (ul_tci_to_release_list_r17_present) {
        HANDLE_CODE(unpack_dyn_seq_of(
            c.get<explicitlist_s_>().ul_tci_to_release_list_r17, bref, 1, 64, integer_packer<uint8_t>(0, 63)));
      }
      break;
    case types::unified_tci_state_ref_r17:
      HANDLE_CODE(c.get<serving_cell_and_bwp_id_r17_s>().unpack(bref));
      break;
    default:
      log_invalid_choice_id(type_, "bwp_ul_ded_s::ul_tci_state_list_r17_c_");
      return SRSASN_ERROR_DECODE_FAIL;
  }
  return SRSASN_SUCCESS;
}

const char* bwp_ul_ded_s::ul_tci_state_list_r17_c_::types_opts::to_string() const
{
  static const char* names[] = {"explicitlist", "unifiedTCI-StateRef-r17"};
  return convert_enum_idx(names, 2, value, "bwp_ul_ded_s::ul_tci_state_list_r17_c_::types");
}

// BWP-Uplink ::= SEQUENCE
SRSASN_CODE bwp_ul_s::pack(bit_ref& bref) const
{
  bref.pack(ext, 1);
  HANDLE_CODE(bref.pack(bwp_common_present, 1));
  HANDLE_CODE(bref.pack(bwp_ded_present, 1));

  HANDLE_CODE(pack_integer(bref, bwp_id, (uint8_t)0u, (uint8_t)4u));
  if (bwp_common_present) {
    HANDLE_CODE(bwp_common.pack(bref));
  }
  if (bwp_ded_present) {
    HANDLE_CODE(bwp_ded.pack(bref));
  }

  return SRSASN_SUCCESS;
}
SRSASN_CODE bwp_ul_s::unpack(cbit_ref& bref)
{
  bref.unpack(ext, 1);
  HANDLE_CODE(bref.unpack(bwp_common_present, 1));
  HANDLE_CODE(bref.unpack(bwp_ded_present, 1));

  HANDLE_CODE(unpack_integer(bwp_id, bref, (uint8_t)0u, (uint8_t)4u));
  if (bwp_common_present) {
    HANDLE_CODE(bwp_common.unpack(bref));
  }
  if (bwp_ded_present) {
    HANDLE_CODE(bwp_ded.unpack(bref));
  }

  return SRSASN_SUCCESS;
}
void bwp_ul_s::to_json(json_writer& j) const
{
  j.start_obj();
  j.write_int("bwp-Id", bwp_id);
  if (bwp_common_present) {
    j.write_fieldname("bwp-Common");
    bwp_common.to_json(j);
  }
  if (bwp_ded_present) {
    j.write_fieldname("bwp-Dedicated");
    bwp_ded.to_json(j);
  }
  j.end_obj();
}

// BWP-UplinkDedicatedSDT-r17 ::= SEQUENCE
SRSASN_CODE bwp_ul_ded_sdt_r17_s::pack(bit_ref& bref) const
{
  bref.pack(ext, 1);
  HANDLE_CODE(bref.pack(pusch_cfg_r17_present, 1));
  HANDLE_CODE(bref.pack(cfg_grant_cfg_to_add_mod_list_r17.size() > 0, 1));
  HANDLE_CODE(bref.pack(cfg_grant_cfg_to_release_list_r17.size() > 0, 1));

  if (pusch_cfg_r17_present) {
    HANDLE_CODE(pusch_cfg_r17.pack(bref));
  }
  if (cfg_grant_cfg_to_add_mod_list_r17.size() > 0) {
    HANDLE_CODE(pack_dyn_seq_of(bref, cfg_grant_cfg_to_add_mod_list_r17, 1, 12));
  }
  if (cfg_grant_cfg_to_release_list_r17.size() > 0) {
    HANDLE_CODE(pack_dyn_seq_of(bref, cfg_grant_cfg_to_release_list_r17, 1, 12, integer_packer<uint8_t>(0, 11)));
  }

  return SRSASN_SUCCESS;
}
SRSASN_CODE bwp_ul_ded_sdt_r17_s::unpack(cbit_ref& bref)
{
  bref.unpack(ext, 1);
  HANDLE_CODE(bref.unpack(pusch_cfg_r17_present, 1));
  bool cfg_grant_cfg_to_add_mod_list_r17_present;
  HANDLE_CODE(bref.unpack(cfg_grant_cfg_to_add_mod_list_r17_present, 1));
  bool cfg_grant_cfg_to_release_list_r17_present;
  HANDLE_CODE(bref.unpack(cfg_grant_cfg_to_release_list_r17_present, 1));

  if (pusch_cfg_r17_present) {
    HANDLE_CODE(pusch_cfg_r17.unpack(bref));
  }
  if (cfg_grant_cfg_to_add_mod_list_r17_present) {
    HANDLE_CODE(unpack_dyn_seq_of(cfg_grant_cfg_to_add_mod_list_r17, bref, 1, 12));
  }
  if (cfg_grant_cfg_to_release_list_r17_present) {
    HANDLE_CODE(unpack_dyn_seq_of(cfg_grant_cfg_to_release_list_r17, bref, 1, 12, integer_packer<uint8_t>(0, 11)));
  }

  return SRSASN_SUCCESS;
}
void bwp_ul_ded_sdt_r17_s::to_json(json_writer& j) const
{
  j.start_obj();
  if (pusch_cfg_r17_present) {
    j.write_fieldname("pusch-Config-r17");
    pusch_cfg_r17.to_json(j);
  }
  if (cfg_grant_cfg_to_add_mod_list_r17.size() > 0) {
    j.start_array("configuredGrantConfigToAddModList-r17");
    for (const auto& e1 : cfg_grant_cfg_to_add_mod_list_r17) {
      e1.to_json(j);
    }
    j.end_array();
  }
  if (cfg_grant_cfg_to_release_list_r17.size() > 0) {
    j.start_array("configuredGrantConfigToReleaseList-r17");
    for (const auto& e1 : cfg_grant_cfg_to_release_list_r17) {
      j.write_int(e1);
    }
    j.end_array();
  }
  j.end_obj();
}
